From: Matthew Fernandez Date: Wed, 14 Sep 2022 01:23:36 +0000 (-0700) Subject: dotgen computeNodeGroups: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~38^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b43e3ba49366725af179719d7947df6d50ff7294;p=graphviz dotgen computeNodeGroups: 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/dotgen/aspect.c b/lib/dotgen/aspect.c index 9d09e30f1..ae67a7923 100644 --- a/lib/dotgen/aspect.c +++ b/lib/dotgen/aspect.c @@ -9,6 +9,7 @@ *************************************************************************/ #include +#include #include #include #include @@ -55,7 +56,7 @@ static void computeNodeGroups(graph_t * g) { node_t *n; - nodeGroups = N_GNEW(agnnodes(g), nodeGroup_t); + nodeGroups = gv_calloc(agnnodes(g), sizeof(nodeGroup_t)); nNodeGroups = 0; @@ -66,7 +67,7 @@ static void computeNodeGroups(graph_t * g) for (n = agfstnode(g); n; n = agnxtnode(g, n)) { if (ND_UF_size(n) == 0) { /* no same ranking constraint */ - nodeGroups[nNodeGroups].nodes = NEW(node_t *); + nodeGroups[nNodeGroups].nodes = gv_alloc(sizeof(node_t*)); nodeGroups[nNodeGroups].nodes[0] = n; nodeGroups[nNodeGroups].nNodes = 1; nodeGroups[nNodeGroups].width = ND_width(n); @@ -90,8 +91,7 @@ static void computeNodeGroups(graph_t * g) ND_id(n) = index; } else /* create a new group */ { - nodeGroups[nNodeGroups].nodes = - N_NEW(ND_UF_size(l), node_t *); + nodeGroups[nNodeGroups].nodes = gv_calloc(ND_UF_size(l), sizeof(node_t*)); if (l == n) /* node n is the leader */ {