From: Matthew Fernandez Date: Fri, 18 Nov 2022 01:14:41 +0000 (-0800) Subject: fdpgen mkClusters: use cgraph wrappers for allocation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ef6c88cb61bff91d9a0e20fa2f0cbb436ec51448;p=graphviz fdpgen mkClusters: 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/fdpgen/layout.c b/lib/fdpgen/layout.c index 8250ab9c0..bf91695bd 100644 --- a/lib/fdpgen/layout.c +++ b/lib/fdpgen/layout.c @@ -984,7 +984,7 @@ mkClusters (graph_t * g, clist_t* pclist, graph_t* parent) { if (!strncmp(agnameof(subg), "cluster", 7)) { agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), true); - GD_alg(subg) = NEW(gdata); /* freed in cleanup_subgs */ + GD_alg(subg) = gv_alloc(sizeof(gdata)); // freed in cleanup_subgs GD_ndim(subg) = GD_ndim(agroot(parent)); LEVEL(subg) = LEVEL(parent) + 1; GPARENT(subg) = parent; @@ -1010,7 +1010,7 @@ mkClusters (graph_t * g, clist_t* pclist, graph_t* parent) static void fdp_init_graph(Agraph_t * g) { setEdgeType (g, EDGETYPE_LINE); - GD_alg(g) = NEW(gdata); /* freed in cleanup_graph */ + GD_alg(g) = gv_alloc(sizeof(gdata)); // freed in cleanup_graph GD_ndim(agroot(g)) = late_int(g, agattr(g,AGRAPH, "dim", NULL), 2, 2); Ndim = GD_ndim(agroot(g)) = MIN(GD_ndim(agroot(g)), MAXDIM);