From: Matthew Fernandez Date: Sat, 3 Sep 2022 18:09:49 +0000 (-0700) Subject: ortho partition: use cgraph wrappers for allocation X-Git-Tag: 6.0.1~11^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23dcac0b20d29bba1cb0c66af6745d5b64ac1ea0;p=graphviz ortho partition: 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/partition.c b/lib/ortho/partition.c index 6122e6715..afddf1036 100644 --- a/lib/ortho/partition.c +++ b/lib/ortho/partition.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -694,15 +693,15 @@ boxf* partition (cell* cells, int ncells, int* nrects, boxf bb) { int nsegs = 4*(ncells+1); - segment_t* segs = N_GNEW(nsegs+1, segment_t); - int* permute = N_NEW(nsegs+1, int); + segment_t* segs = gv_calloc(nsegs + 1, sizeof(segment_t)); + int* permute = gv_calloc(nsegs + 1, sizeof(int)); int hd_size, vd_size; int i, j, cnt = 0; boxf* rs; int ntraps = TRSIZE(nsegs); - trap_t* trs = N_GNEW(ntraps, trap_t); - boxf* hor_decomp = N_NEW(ntraps, boxf); - boxf* vert_decomp = N_NEW(ntraps, boxf); + trap_t* trs = gv_calloc(ntraps, sizeof(trap_t)); + boxf* hor_decomp = gv_calloc(ntraps, sizeof(boxf)); + boxf* vert_decomp = gv_calloc(ntraps, sizeof(boxf)); int nt; if (DEBUG) { @@ -733,13 +732,13 @@ partition (cell* cells, int ncells, int* nrects, boxf bb) } vd_size = monotonate_trapezoids (nsegs, segs, trs, 1, vert_decomp); - rs = N_NEW (hd_size*vd_size, boxf); + rs = gv_calloc(hd_size * vd_size, sizeof(boxf)); for (i=0; i