From: Matthew Fernandez Date: Mon, 26 Dec 2022 05:41:23 +0000 (-0800) Subject: neatogen scan_graph_mode: use cgraph wrappers for allocation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29217d44733837e16e60f314de69341fbf226094;p=graphviz neatogen scan_graph_mode: use cgraph wrappers for allocation The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h wrappers except (1) they are header-only and (2) they live in a directory (cgraph) that is at the root of the dependency tree. The long term plan is to replace all use of lib/common/memory.h with lib/cgraph/alloc.h. --- diff --git a/lib/neatogen/stuff.c b/lib/neatogen/stuff.c index 1cdfa208c..d1ac1bc99 100644 --- a/lib/neatogen/stuff.c +++ b/lib/neatogen/stuff.c @@ -250,7 +250,7 @@ int scan_graph_mode(graph_t * G, int mode) Damping = atof(str); else Damping = .99; - GD_neato_nlist(G) = N_NEW(nV + 1, node_t *); + GD_neato_nlist(G) = gv_calloc(nV + 1, sizeof(node_t*)); for (i = 0, np = agfstnode(G); np; np = agnxtnode(G, np)) { GD_neato_nlist(G)[i] = np; ND_id(np) = i++; @@ -260,7 +260,7 @@ int scan_graph_mode(graph_t * G, int mode) } else if (mode == MODE_SGD) { Epsilon = .01; getdouble(G, "epsilon", &Epsilon); - GD_neato_nlist(G) = N_NEW(nV + 1, node_t *); // not sure why but sometimes needs the + 1 + GD_neato_nlist(G) = gv_calloc(nV + 1, sizeof(node_t*)); // not sure why but sometimes needs the + 1 for (i = 0, np = agfstnode(G); np; np = agnxtnode(G, np)) { GD_neato_nlist(G)[i] = np; ND_id(np) = i++;