]> granicus.if.org Git - graphviz/commitdiff
topfish set_active_levels: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 18 Sep 2022 17:15:39 +0000 (10:15 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 21 Sep 2022 01:11:01 +0000 (18:11 -0700)
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.

lib/topfish/hierarchy.c

index ef693f464156caf29eeef33abe9aa7c21de32638..f1aa0cfd26e2c87c3d0a62090e31ff480f8acb84 100644 (file)
@@ -801,8 +801,8 @@ set_active_levels(Hierarchy * hierarchy, int *foci_nodes, int num_foci,
     n = hierarchy->nvtxs[min_level];
 
     // compute distances from foci nodes
-    nodes = N_NEW(n, int);
-    distances = N_NEW(n, double);
+    nodes = gv_calloc(n, sizeof(int));
+    distances = gv_calloc(n, sizeof(double));
     for (i = 0; i < n; i++) {
        nodes[i] = i;
        distances[i] = dist_from_foci(graph, i, foci_nodes, num_foci);