From 8fa281786d15a7c9a3225ca30384b1d7e95ba24d Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 21 Sep 2022 21:13:13 -0700 Subject: [PATCH] gvpack: 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. --- cmd/tools/gvpack.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/tools/gvpack.cpp b/cmd/tools/gvpack.cpp index 2231e9f96..3b023e914 100644 --- a/cmd/tools/gvpack.cpp +++ b/cmd/tools/gvpack.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -545,7 +546,7 @@ static void cloneClusterTree(Agraph_t * g, Agraph_t * ng) if (GD_n_cluster(g)) { GD_n_cluster(ng) = GD_n_cluster(g); - GD_clust(ng) = N_NEW(1 + GD_n_cluster(g), Agraph_t *); + GD_clust(ng) = reinterpret_cast(gv_calloc(1 + GD_n_cluster(g), sizeof(Agraph_t*))); for (i = 1; i <= GD_n_cluster(g); i++) { Agraph_t *c = GETCLUST(GD_clust(g)[i]); GD_clust(ng)[i] = c; @@ -621,7 +622,7 @@ static Agraph_t *cloneGraph(std::vector &gs, GVC_t *gvc) { /* set up cluster tree */ if (GD_n_cluster(root)) { int j, idx; - GD_clust(root) = N_NEW(1 + GD_n_cluster(root), graph_t *); + GD_clust(root) = reinterpret_cast(gv_calloc(1 + GD_n_cluster(root), sizeof(graph_t*))); idx = 1; for (Agraph_t *g : gs) { -- 2.40.0