From: Matthew Fernandez Date: Fri, 18 Nov 2022 01:14:41 +0000 (-0800) Subject: neatogen makeMultiSpline: use cgraph wrapper for allocation X-Git-Tag: 7.0.3~11^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=31c77cb7122c41be6be9d16b297f11b8fd420bb7;p=graphviz neatogen makeMultiSpline: 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. --- diff --git a/lib/neatogen/multispline.c b/lib/neatogen/multispline.c index 8f92127fc..14164fb1c 100644 --- a/lib/neatogen/multispline.c +++ b/lib/neatogen/multispline.c @@ -1253,8 +1253,6 @@ int makeMultiSpline(edge_t* e, router_t * rtr, int doPolyline) { int h_id = rtr->tn + 1; int ecnt = rtr->tg->nedges; PPQ pq; - PQTYPE *idxs; - PQVTYPE *vals; int ret; // record the number of edges in each node, so we can drop the added ones @@ -1270,8 +1268,8 @@ int makeMultiSpline(edge_t* e, router_t * rtr, int doPolyline) { /* Initialize priority queue */ PQgen(&pq.pq, rtr->tn + 2, -1); - idxs = N_GNEW(pq.pq.PQsize + 1, PQTYPE); - vals = N_GNEW(pq.pq.PQsize + 1, PQVTYPE); + PQTYPE *idxs = gv_calloc(pq.pq.PQsize + 1, sizeof(PQTYPE)); + PQVTYPE *vals = gv_calloc(pq.pq.PQsize + 1, sizeof(PQVTYPE)); vals[0] = 0; pq.vals = vals + 1; pq.idxs = idxs + 1;