]> granicus.if.org Git - graphviz/commitdiff
pack putGraphs: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 21 Sep 2022 02:16:26 +0000 (19:16 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 22 Sep 2022 00:00:18 +0000 (17:00 -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/pack/pack.c

index 2d580ee4bc1206c5933e480d281f309b5fe04d02..3e5d88ff7cb00023ee439da170433e24aa3a8fe8 100644 (file)
@@ -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)