]> granicus.if.org Git - graphviz/commitdiff
ortho initSEdges: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 3 Sep 2022 18:01:45 +0000 (11:01 -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 2e7d4b9b97e6ad337cf874902858bfdc25db44c2..591a34a542b83da895b9db114642c3559e057fa5 100644 (file)
@@ -10,7 +10,7 @@
 
 
 #include "config.h"
-
+#include <cgraph/alloc.h>
 #include <limits.h>
 #include <common/memory.h>
 #include <ortho/sgraph.h>
@@ -42,8 +42,8 @@ void
 initSEdges (sgraph* g, int maxdeg)
 {
     int i;
-    int* adj = N_NEW (6*g->nnodes + 2*maxdeg, int);
-    g->edges = N_NEW (3*g->nnodes + maxdeg, sedge);
+    int* adj = gv_calloc(6 * g->nnodes + 2 * maxdeg, sizeof(int));
+    g->edges = gv_calloc(3 * g->nnodes + maxdeg, sizeof(sedge));
     for (i = 0; i < g->nnodes; i++) {
        g->nodes[i].adj_edge_list = adj;
        adj += 6;