ortho mkStack: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 3 Sep 2022 18:03:48 +0000 (11:03 -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/rawgraph.c

index 1e4d7c3ef9e7f68e6212e90ad331d56352772d98..ab2f04fc701c7867bf7998ada1e875e41a03d823 100644 (file)
@@ -13,7 +13,6 @@
 #include "config.h"
 #include <cgraph/alloc.h>
 #include <ortho/rawgraph.h>
-#include <common/memory.h>
 #include <common/intset.h>
 #include <stdbool.h>
 
@@ -78,8 +77,8 @@ typedef struct {
 static stack*
 mkStack (int i)
 {
-    stack* sp = NEW(stack);
-    sp->vals = N_NEW(i,int);
+    stack* sp = gv_alloc(sizeof(stack));
+    sp->vals = gv_calloc(i, sizeof(int));
     sp->top = -1;
     return sp;
 }