From: Matthew Fernandez Date: Fri, 18 Nov 2022 01:14:41 +0000 (-0800) Subject: twopigen twopi_init_node_edge: use cgraph wrappers for allocation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5cd3f4f91ce9fd930ec0d10ada8aee160239ab7;p=graphviz twopigen twopi_init_node_edge: 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/twopigen/twopiinit.c b/lib/twopigen/twopiinit.c index 705ca4834..c00895b1c 100644 --- a/lib/twopigen/twopiinit.c +++ b/lib/twopigen/twopiinit.c @@ -14,6 +14,7 @@ * Derived from Graham Wills' algorithm described in GD'97. */ +#include #include #include #include @@ -33,10 +34,9 @@ static void twopi_init_node_edge(graph_t * g) edge_t *e; int i = 0; int n_nodes = agnnodes(g); - rdata* alg; - alg = N_NEW(n_nodes, rdata); - GD_neato_nlist(g) = N_NEW(n_nodes + 1, node_t *); + rdata* alg = gv_calloc(n_nodes, sizeof(rdata)); + GD_neato_nlist(g) = gv_calloc(n_nodes + 1, sizeof(node_t*)); for (n = agfstnode(g); n; n = agnxtnode(g, n)) { neato_init_node(n); ND_alg(n) = alg + i;