From: Matthew Fernandez Date: Wed, 21 Sep 2022 02:16:26 +0000 (-0700) Subject: pack putGraphs: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~31^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e70de1b35aeb3a014931e57df8253521dc7bcea6;p=graphviz pack putGraphs: 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/pack/pack.c b/lib/pack/pack.c index 2d580ee4b..3e5d88ff7 100644 --- a/lib/pack/pack.c +++ b/lib/pack/pack.c @@ -901,7 +901,6 @@ point *putGraphs(int ng, Agraph_t ** gs, Agraph_t * root, pack_info * pinfo) { int i, v; - boxf* bbs; Agraph_t* g; point* pts = NULL; char* s; @@ -911,7 +910,7 @@ point *putGraphs(int ng, Agraph_t ** gs, Agraph_t * root, if (pinfo->mode <= l_graph) return polyGraphs (ng, gs, root, pinfo); - bbs = N_GNEW(ng, boxf); + boxf *bbs = gv_calloc(ng, sizeof(boxf)); for (i = 0; i < ng; i++) { g = gs[i]; @@ -921,7 +920,7 @@ point *putGraphs(int ng, Agraph_t ** gs, Agraph_t * root, if (pinfo->mode == l_array) { if (pinfo->flags & PK_USER_VALS) { - pinfo->vals = N_NEW(ng, packval_t); + pinfo->vals = gv_calloc(ng, sizeof(packval_t)); for (i = 0; i < ng; i++) { s = agget (gs[i], "sortv"); if (s && sscanf(s, "%d", &v) > 0 && v >= 0)