From bfcb14550759dbdd2a85adfcc0041eb39b778ee9 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 17 Nov 2022 17:14:41 -0800 Subject: [PATCH] neatogen genroute: use cgraph wrapper 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/neatogen/multispline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/neatogen/multispline.c b/lib/neatogen/multispline.c index 7e77cc74c..9d3227e0b 100644 --- a/lib/neatogen/multispline.c +++ b/lib/neatogen/multispline.c @@ -797,7 +797,7 @@ static int genroute(tripoly_t * trip, int s, int t, edge_t * e, int doPolyline) if ((mult == 1) || Concentrate) { poly = trip->poly; - medges = N_GNEW(poly.pn, Pedge_t); + medges = gv_calloc(poly.pn, sizeof(Pedge_t)); for (j = 0; j < poly.pn; j++) { medges[j].a = poly.ps[j]; medges[j].b = poly.ps[(j + 1) % poly.pn]; @@ -816,7 +816,7 @@ static int genroute(tripoly_t * trip, int s, int t, edge_t * e, int doPolyline) pn = 2 * (pl.pn - 1); - cpts = N_NEW(pl.pn - 2, pointf *); + cpts = gv_calloc(pl.pn - 2, sizeof(pointf *)); for (i = 0; i < pl.pn - 2; i++) { cpts[i] = mkCtrlPts(t, mult+1, pl.ps[i], pl.ps[i + 1], pl.ps[i + 2], trip); @@ -827,7 +827,7 @@ static int genroute(tripoly_t * trip, int s, int t, edge_t * e, int doPolyline) } } - poly.ps = N_GNEW(pn, pointf); + poly.ps = gv_calloc(pn, sizeof(pointf)); poly.pn = pn; for (i = 0; i < mult; i++) { @@ -849,7 +849,7 @@ static int genroute(tripoly_t * trip, int s, int t, edge_t * e, int doPolyline) make_polyline (mmpl, &spl); } else { - medges = N_GNEW(poly.pn, Pedge_t); + medges = gv_calloc(poly.pn, sizeof(Pedge_t)); for (j = 0; j < poly.pn; j++) { medges[j].a = poly.ps[j]; medges[j].b = poly.ps[(j + 1) % poly.pn]; -- 2.40.0