From: Matthew Fernandez Date: Sun, 20 Nov 2022 20:02:53 +0000 (-0800) Subject: circogen find_pair_edges: use cgraph wrappers for allocation X-Git-Tag: 7.0.3~2^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=244b26b9b380d0ce3e683fccdcb0e451fce368f7;p=graphviz circogen find_pair_edges: 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/circogen/blockpath.c b/lib/circogen/blockpath.c index 366e1cd60..ee91d462a 100644 --- a/lib/circogen/blockpath.c +++ b/lib/circogen/blockpath.c @@ -8,7 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ - +#include #include #include #include @@ -84,9 +84,6 @@ static deglist_t *getList(Agraph_t * g) */ static void find_pair_edges(Agraph_t * g, Agnode_t * n, Agraph_t * outg) { - Agnode_t **neighbors_with; - Agnode_t **neighbors_without; - Agedge_t *e; Agedge_t *ep; Agedge_t *ex; @@ -100,8 +97,8 @@ static void find_pair_edges(Agraph_t * g, Agnode_t * n, Agraph_t * outg) int edge_cnt = 0; node_degree = DEGREE(n); - neighbors_with = N_GNEW(node_degree, Agnode_t *); - neighbors_without = N_GNEW(node_degree, Agnode_t *); + Agnode_t **neighbors_with = gv_calloc(node_degree, sizeof(Agnode_t*)); + Agnode_t **neighbors_without = gv_calloc(node_degree, sizeof(Agnode_t*)); for (e = agfstedge(g, n); e; e = agnxtedge(g, e, n)) { n1 = aghead(e);