]> granicus.if.org Git - graphviz/commitdiff
topfish init_ex_graph: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 18 Sep 2022 17:16:07 +0000 (10:16 -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 f1aa0cfd26e2c87c3d0a62090e31ff480f8acb84..0e196ad7ab5428601c45a42516801b78f8331393 100644 (file)
@@ -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;