From: Matthew Fernandez Date: Fri, 2 Sep 2022 01:48:54 +0000 (-0700) Subject: smyrna makeXDotSpline: use cgraph wrapper for allocations X-Git-Tag: 6.0.1~13^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb5ffc30cc4b118de3120d9a12dcd69e3202d919;p=graphviz smyrna makeXDotSpline: use cgraph wrapper for allocations 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/cmd/smyrna/topviewfuncs.c b/cmd/smyrna/topviewfuncs.c index 2f1c9f2bf..4731d6ed9 100644 --- a/cmd/smyrna/topviewfuncs.c +++ b/cmd/smyrna/topviewfuncs.c @@ -10,6 +10,7 @@ #include #include "topviewfuncs.h" +#include #include #include "smyrna_utils.h" #include @@ -18,7 +19,6 @@ #include #include #include "selectionfuncs.h" -#include #include #include #include @@ -556,16 +556,13 @@ static xdot* makeXDotSpline (char* pos) int v, have_s, have_e; size_t cnt; static const size_t sz = sizeof(sdot_op); - xdot* xd; - xdot_op* op; - xdot_point* pts; if (*pos == '\0') return NULL; pos = countPoints (pos, &have_s, &s, &have_e, &e, &cnt); if (pos == 0) return NULL; - pts = N_NEW(cnt,xdot_point); + xdot_point* pts = gv_calloc(cnt, sizeof(xdot_point)); if (have_s) { v = storePoints (pos, pts+3); pts[0] = pts[1] = s; @@ -583,13 +580,13 @@ static xdot* makeXDotSpline (char* pos) pts[cnt-3] = pts[cnt-4]; } - op = (xdot_op*)N_NEW(sz,char); + xdot_op* op = gv_calloc(sz, sizeof(char)); op->kind = xd_unfilled_bezier; op->drawfunc = OpFns[xop_bezier]; op->u.bezier.cnt = cnt; op->u.bezier.pts = pts; - xd = NEW(xdot); + xdot* xd = gv_alloc(sizeof(xdot)); xd->cnt = 1; xd->sz = sz; xd->ops = op;