]> granicus.if.org Git - graphviz/commitdiff
ortho convertSPtoRoute: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 3 Sep 2022 17:55:41 +0000 (10:55 -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/ortho.c

index d68d800cd5efa0e6eab7772b51c23c7ffb864c02..8c833cdcc360e8305de55c49e1e593b082568ced 100644 (file)
@@ -28,6 +28,7 @@
 #include <ortho/maze.h>
 #include <ortho/fPQ.h>
 #include <ortho/ortho.h>
+#include <cgraph/alloc.h>
 #include <cgraph/exit.h>
 #include <cgraph/unused.h>
 #include <common/memory.h>
@@ -160,7 +161,7 @@ convertSPtoRoute (sgraph* g, snode* fst, snode* lst)
     for (ptr = fst; ptr; ptr = N_DAD(ptr)) sz++;
     rte.n = 0;
     assert(sz >= 2);
-    rte.segs = N_NEW(sz-2, segment);  /* at most sz-2 segments */
+    rte.segs = gv_calloc(sz - 2, sizeof(segment));  /* at most sz-2 segments */
 
     seg.prev = seg.next = 0;
     ptr = prev = N_DAD(fst);