From e123f571333ebb959b962268c13086d0e0c5d71d Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 3 Sep 2022 11:13:54 -0700 Subject: [PATCH] ortho mkMaze: use cgraph wrappers for allocation 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/maze.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ortho/maze.c b/lib/ortho/maze.c index 2dc1c921c..818ff90de 100644 --- a/lib/ortho/maze.c +++ b/lib/ortho/maze.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #define MARGIN 36; @@ -467,7 +466,7 @@ chkSgraph (g); maze *mkMaze(graph_t *g) { node_t* n; - maze* mp = NEW(maze); + maze* mp = gv_alloc(sizeof(maze)); boxf* rects; int i, nrect; cell* cp; @@ -475,7 +474,7 @@ maze *mkMaze(graph_t *g) { boxf bb, BB; mp->ngcells = agnnodes(g); - cp = mp->gcells = N_NEW(mp->ngcells, cell); + cp = mp->gcells = gv_calloc(mp->ngcells, sizeof(cell)); BB.LL.x = BB.LL.y = MAXDOUBLE; BB.UR.x = BB.UR.y = -MAXDOUBLE; @@ -505,7 +504,7 @@ maze *mkMaze(graph_t *g) { #ifdef DEBUG if (odb_flags & ODB_MAZE) psdump (mp->gcells, mp->ngcells, BB, rects, nrect); #endif - mp->cells = N_NEW(nrect, cell); + mp->cells = gv_calloc(nrect, sizeof(cell)); mp->ncells = nrect; for (i = 0; i < nrect; i++) { mp->cells[i].bb = rects[i]; -- 2.40.0