From: Matthew Fernandez Date: Sat, 3 Sep 2022 18:13:16 +0000 (-0700) Subject: ortho mkMazeGraph: use cgraph wrappers for allocation X-Git-Tag: 6.0.1~11^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=194a14408a14dc036e6935dacce78cf274f88242;p=graphviz ortho mkMazeGraph: 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. --- diff --git a/lib/ortho/maze.c b/lib/ortho/maze.c index 78d7073ff..2dc1c921c 100644 --- a/lib/ortho/maze.c +++ b/lib/ortho/maze.c @@ -13,6 +13,7 @@ #define DEBUG +#include #include #include #include @@ -347,14 +348,14 @@ mkMazeGraph (maze* mp, boxf bb) sgraph* g = createSGraph (bound + 2); Dt_t* vdict = dtopen(&vdictDisc,Dtoset); Dt_t* hdict = dtopen(&hdictDisc,Dtoset); - snodeitem* ditems = N_NEW(bound, snodeitem); + snodeitem* ditems = gv_calloc(bound, sizeof(snodeitem)); snode** sides; /* For each cell, create if necessary and attach a node in search * corresponding to each internal face. The node also gets * a pointer to the cell. */ - sides = N_NEW(4*mp->ncells, snode*); + sides = gv_calloc(4 * mp->ncells, sizeof(snode*)); for (i = 0; i < mp->ncells; i++) { cell* cp = mp->cells+i; snode* np; @@ -392,7 +393,7 @@ mkMazeGraph (maze* mp, boxf bb) * connect it to its corresponding search nodes. */ maxdeg = 0; - sides = N_NEW(g->nnodes, snode*); + sides = gv_calloc(g->nnodes, sizeof(snode*)); nsides = 0; for (i = 0; i < mp->ngcells; i++) { cell* cp = mp->gcells+i;