]> granicus.if.org Git - graphviz/commitdiff
dotgen build_skeleton: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 14 Sep 2022 00:57:32 +0000 (17:57 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 14 Sep 2022 00:57:32 +0000 (17:57 -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/dotgen/cluster.c

index 1ce49887f06e6eb118b1e378d8f759a7eaaf2ced..f0f807653d158b671a2e0cb57c28687f773612ff 100644 (file)
@@ -9,6 +9,7 @@
  *************************************************************************/
 
 #include <assert.h>
+#include <cgraph/alloc.h>
 #include <dotgen/dot.h>
 #include <stdbool.h>
 
@@ -353,7 +354,7 @@ void build_skeleton(graph_t * g, graph_t * subg)
     edge_t *e;
 
     prev = NULL;
-    GD_rankleader(subg) = N_NEW(GD_maxrank(subg) + 2, node_t *);
+    GD_rankleader(subg) = gv_calloc(GD_maxrank(subg) + 2, sizeof(node_t*));
     for (r = GD_minrank(subg); r <= GD_maxrank(subg); r++) {
        v = GD_rankleader(subg)[r] = virtual_node(g);
        ND_rank(v) = r;