From: Matthew Fernandez Date: Wed, 14 Sep 2022 01:35:25 +0000 (-0700) Subject: dotgen _dot_splines: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~38^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a8521f87c2b2a8da29e9eaefd584ef88128650b;p=graphviz dotgen _dot_splines: 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/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index d42b24b2f..f4e30b509 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -349,11 +349,11 @@ static void _dot_splines(graph_t * g, int normalize) mark_lowclusters(g); if (routesplinesinit()) return; - P = NEW(path); + P = gv_alloc(sizeof(path)); /* FlatHeight = 2 * GD_nodesep(g); */ sd.Splinesep = GD_nodesep(g) / 4; sd.Multisep = GD_nodesep(g); - edges = N_NEW(CHUNK, edge_t *); + edges = gv_calloc(CHUNK, sizeof(edge_t*)); /* compute boundaries and list of splines */ sd.LeftBound = sd.RightBound = 0; @@ -425,8 +425,8 @@ static void _dot_splines(graph_t * g, int normalize) qsort(edges, n_edges, sizeof(edges[0]), (qsort_cmpf)edgecmp); /* FIXME: just how many boxes can there be? */ - P->boxes = N_NEW(n_nodes + 20 * 2 * NSUB, boxf); - sd.Rank_box = N_NEW(i, boxf); + P->boxes = gv_calloc(n_nodes + 20 * 2 * NSUB, sizeof(boxf)); + sd.Rank_box = gv_calloc(i, sizeof(boxf)); if (et == EDGETYPE_LINE) { /* place regular edge labels */ @@ -480,7 +480,7 @@ static void _dot_splines(graph_t * g, int normalize) if (cnt == 1) edgelist = &e0; else - edgelist = N_NEW(cnt, edge_t*); + edgelist = gv_calloc(cnt, sizeof(edge_t*)); edgelist[0] = getmainedge((edges+ind)[0]); for (ii = 1; ii < cnt; ii++) edgelist[ii] = (edges+ind)[ii];