]> granicus.if.org Git - graphviz/commitdiff
label doxlabel: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 5 Sep 2022 15:48:51 +0000 (08:48 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 6 Sep 2022 14:34:33 +0000 (07:34 -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/label/nrtmain.c

index b363aa3564db33ac93830b4a698bb9d2262433fb..d19d960612c5af5f3aadee7021b75d7464b17e6a 100644 (file)
@@ -11,9 +11,8 @@
 #include <errno.h>
 #include <stddef.h>
 #include <string.h>
-
+#include <cgraph/alloc.h>
 #include <cgraph/exit.h>
-#include <common/memory.h>
 #include <gvc/gvc.h>
 #include <labels/xlabels.h>
 
@@ -128,8 +127,8 @@ int doxlabel(opts_t * opts)
     }
     n_objs = agnnodes(gp) + n_elbls;
     n_lbls = n_nlbls + n_elbls;
-    objp = objs = N_NEW(n_objs, object_t);
-    xlp = lbls = N_NEW(n_lbls, xlabel_t);
+    objp = objs = gv_calloc(n_objs, sizeof(object_t));
+    xlp = lbls = gv_calloc(n_lbls, sizeof(xlabel_t));
     bb.LL = pointfof(INT_MAX, INT_MAX);
     bb.UR = pointfof(-INT_MAX, -INT_MAX);