]> granicus.if.org Git - graphviz/commitdiff
ortho createSGraph: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 3 Sep 2022 18:02:14 +0000 (11:02 -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/sgraph.c

index 591a34a542b83da895b9db114642c3559e057fa5..215888396f3d71f4a30b9ba16a4721a02eb8b977 100644 (file)
@@ -12,7 +12,6 @@
 #include "config.h"
 #include <cgraph/alloc.h>
 #include <limits.h>
-#include <common/memory.h>
 #include <ortho/sgraph.h>
 #include <ortho/fPQ.h>
 
@@ -57,11 +56,11 @@ initSEdges (sgraph* g, int maxdeg)
 sgraph*
 createSGraph (int nnodes)
 {
-    sgraph* g = NEW(sgraph);
+    sgraph* g = gv_alloc(sizeof(sgraph));
 
        /* create the nodes vector in the search graph */
     g->nnodes = 0;
-    g->nodes = N_NEW(nnodes, snode);
+    g->nodes = gv_calloc(nnodes, sizeof(snode));
     return g;
 }