From: Matthew Fernandez Date: Sun, 18 Sep 2022 17:14:21 +0000 (-0700) Subject: topfish cpGraph: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~32^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd115a8fa17c50a68a24511e18ea6fe9a67043ac;p=graphviz topfish cpGraph: 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 28f0038b4..f365a4470 100644 --- a/lib/topfish/hierarchy.c +++ b/lib/topfish/hierarchy.c @@ -642,18 +642,16 @@ void release(Hierarchy * hierarchy) static v_data *cpGraph(v_data * graph, int n, int nedges) { - v_data *cpGraph; - int *edges; float *ewgts = NULL; int i, j; if (graph == NULL || n == 0) { return NULL; } - cpGraph = N_NEW(n, v_data); - edges = N_NEW(2 * nedges + n, int); + v_data *cpGraph = gv_calloc(n, sizeof(v_data)); + int *edges = gv_calloc(2 * nedges + n, sizeof(int)); if (graph[0].ewgts != NULL) { - ewgts = N_NEW(2 * nedges + n, float); + ewgts = gv_calloc(2 * nedges + n, sizeof(float)); } for (i = 0; i < n; i++) {