]> granicus.if.org Git - graphviz/commitdiff
neatogen mkCtrlPts: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 19 Nov 2022 05:29:08 +0000 (21:29 -0800)
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

index 7d6c92f654dd6d7fa27dd491f9bc89339c258251..ec3b963d5e6b7f3664b8a927cc7493e4127e4bf5 100644 (file)
@@ -338,7 +338,6 @@ static int ctrlPtIdx(pointf v, Ppoly_t * polys)
 static pointf *mkCtrlPts(int s, int mult, pointf prev, pointf v,
                           pointf nxt, tripoly_t * trip)
 {
-    pointf *ps;
     int idx = ctrlPtIdx(v, &(trip->poly));
     int i;
     double d, sep, theta, sinTheta, cosTheta;
@@ -347,7 +346,7 @@ static pointf *mkCtrlPts(int s, int mult, pointf prev, pointf v,
     if (idx < 0)
        return NULL;
 
-    ps = N_GNEW(mult, pointf);
+    pointf *ps = gv_calloc(mult, sizeof(pointf));
     theta = bisect(prev, v, nxt);
     sinTheta = sin(theta);
     cosTheta = cos(theta);