* Contributors: Details at https://graphviz.org
*************************************************************************/
+#include <cgraph/alloc.h>
#include <common/types.h>
#include <common/utils.h>
#include "convert.h"
#define SMALLBUF 128
-#define NEW(t) malloc(sizeof(t))
-#define N_NEW(n,t) calloc((n),sizeof(t))
#define EMPTY(s) ((s == 0) || (*s == '\0'))
#define SLEN(s) (sizeof(s)-1)
(void)d;
(void)disc;
- namev_t *np = NEW(namev_t);
+ namev_t *np = gv_alloc(sizeof(*np));
np->name = objp->name;
np->unique_name = 0;
return np;
*/
static char *addid(Dt_t * ids, char *id)
{
- idv_t *idp = NEW(idv_t);
+ idv_t *idp = gv_alloc(sizeof(*idp));
- idp->name = strdup(id);
+ idp->name = gv_strdup(id);
dtinsert(ids, idp);
return idp->name;
}
char *endp; /* where to append ':' and number */
char *rv;
- char *bp = N_NEW(len, char);
+ char *bp = gv_calloc(len, sizeof(bp[0]));
endp = bp + (baselen - 1);
sprintf(bp, "%s%s%s", tname, EDGEOP, hname);
/* this must be anonymous graph */
len = strlen(name) + sizeof("N_");
- char *bp = N_NEW(len, char);
+ char *bp = gv_calloc(len, sizeof(bp[0]));
sprintf(bp, "N_%s", name);
if (idexists(stp->idList, bp) || !legalGXLName(bp)) {
bp = createNodeId(stp->idList);
static gxlstate_t *initState(Agraph_t * g)
{
- gxlstate_t *stp = NEW(gxlstate_t);
+ gxlstate_t *stp = gv_alloc(sizeof(*stp));
stp->nodeMap = dtopen(&nameDisc, Dtoset);
stp->graphMap = dtopen(&nameDisc, Dtoset);
stp->synNodeMap = dtopen(&nameDisc, Dtoset);