]> granicus.if.org Git - graphviz/commitdiff
smyrna positionAllItems: use cgraph wrapper for allocations
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:51:09 +0000 (18:51 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:51:09 +0000 (18:51 -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.

cmd/smyrna/hier.c

index 8354232a7559eab69b0b7c75ec00567d1b3d36b6..d73149c419bdd9e44d5cd0f0b34df4f24414f277 100644 (file)
@@ -8,6 +8,7 @@
  * Contributors: Details at https://graphviz.org
  *************************************************************************/
 
+#include <cgraph/alloc.h>
 #include "smyrnadefs.h"
 #include "hier.h"
 #include <math.h>
@@ -63,8 +64,8 @@ void positionAllItems(Hierarchy * hp, focus_t * fs, reposition_t * parms)
     int i;
     int interval = 20;
     int counter = 0;           /* no. of active nodes */
-    double *x_coords = N_NEW(hp->nvtxs[0], double);
-    double *y_coords = N_NEW(hp->nvtxs[0], double);
+    double *x_coords = gv_calloc(hp->nvtxs[0], sizeof(double));
+    double *y_coords = gv_calloc(hp->nvtxs[0], sizeof(double));
     int max_level = hp->nlevels - 1;   // coarsest level
     double width = parms->width;
     double height = parms->height;