From: Matthew Fernandez Date: Sun, 18 Sep 2022 17:16:07 +0000 (-0700) Subject: topfish init_ex_graph: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~32^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=836ddfe2745e77cb5c606a4077534cdd613894c6;p=graphviz topfish init_ex_graph: 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/topfish/hierarchy.c b/lib/topfish/hierarchy.c index f1aa0cfd2..0e196ad7a 100644 --- a/lib/topfish/hierarchy.c +++ b/lib/topfish/hierarchy.c @@ -982,7 +982,6 @@ init_ex_graph(v_data * graph1, v_data * graph2, int n, ex_vtx_data *geom_graph; int nedges1 = 0, nedges2 = 0; - int *edges; int nedges = 0; int i, j, k, l, first_nedges; int neighbor; @@ -990,8 +989,8 @@ init_ex_graph(v_data * graph1, v_data * graph2, int n, nedges1 += graph1[i].nedges; nedges2 += graph2[i].nedges; } - edges = N_NEW(nedges1 + nedges2, int); - *gp = geom_graph = N_NEW(n, ex_vtx_data); + int *edges = gv_calloc(nedges1 + nedges2, sizeof(int)); + *gp = geom_graph = gv_calloc(n, sizeof(ex_vtx_data)); for (i = 0; i < n; i++) { geom_graph[i].edges = edges;