From: Matthew Fernandez Date: Fri, 18 Nov 2022 01:14:41 +0000 (-0800) Subject: osage layout: use cgraph wrappers for allocation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90418f7cc08c8761d5b57db1e70beb274d0b6248;p=graphviz osage layout: 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/osage/osageinit.c b/lib/osage/osageinit.c index fbffa70fd..0c3ef0591 100644 --- a/lib/osage/osageinit.c +++ b/lib/osage/osageinit.c @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -62,14 +63,12 @@ layout (Agraph_t* g, int depth) int nvs = 0; /* no. of nodes in subclusters */ Agnode_t* n; Agraph_t* subg; - boxf* gs; point* pts; boxf bb, rootbb; pointf p; pack_info pinfo; pack_mode pmode; double margin; - void** children; Agsym_t* cattr = NULL; Agsym_t* vattr = NULL; Agraph_t* root = g->root; @@ -103,14 +102,14 @@ layout (Agraph_t* g, int depth) cattr = agattr(root, AGRAPH, "sortv", 0); vattr = agattr(root, AGNODE, "sortv", 0); if (cattr || vattr) - pinfo.vals = N_NEW(total, packval_t); + pinfo.vals = gv_calloc(total, sizeof(packval_t)); else agerr (AGWARN, "Graph %s has array packing with user values but no \"sortv\" attributes are defined.", agnameof(g)); } - gs = N_NEW(total, boxf); - children = N_NEW(total, void*); + boxf *gs = gv_calloc(total, sizeof(boxf)); + void **children = gv_calloc(total, sizeof(void*)); j = 0; for (i = 1; i <= GD_n_cluster(g); i++) { subg = GD_clust(g)[i];