]> granicus.if.org Git - graphviz/commitdiff
ortho monotonate_trapezoids: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 3 Sep 2022 18:09:19 +0000 (11:09 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 4 Sep 2022 23:32:29 +0000 (16:32 -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/ortho/partition.c

index 6dcbada7a46a84cee0a2c9aa384fb1efda7f9b12..6122e6715fb8f9c2e74d76441a1fe84ea0379aad 100644 (file)
@@ -9,7 +9,7 @@
  *************************************************************************/
 
 #include "config.h"
-
+#include <cgraph/alloc.h>
 #include <ortho/partition.h>
 #include <ortho/trap.h>
 #include <common/memory.h>
@@ -599,11 +599,11 @@ monotonate_trapezoids(int nsegs, segment_t*seg, trap_t* tr,
     int i, size;
     int tr_start;
     int tr_size = TRSIZE(nsegs);
-    int* visited = N_NEW(tr_size,int);
+    int* visited = gv_calloc(tr_size, sizeof(int));
 
-    mchain = N_NEW(tr_size, monchain_t);
-    vert = N_NEW(nsegs+1,vertexchain_t); 
-    mon = N_NEW(nsegs, int);    
+    mchain = gv_calloc(tr_size, sizeof(monchain_t));
+    vert = gv_calloc(nsegs + 1, sizeof(vertexchain_t));
+    mon = gv_calloc(nsegs, sizeof(int));
 
   /* First locate a trapezoid which lies inside the polygon */
   /* and which is triangular */