From: Matthew Fernandez Date: Mon, 26 Dec 2022 05:41:23 +0000 (-0800) Subject: neatogen new_3array: use cgraph wrappers for allocation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e17115e4c77f3f26a4052259dd1b8b4c6e2e2057;p=graphviz neatogen new_3array: 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/neatogen/stuff.c b/lib/neatogen/stuff.c index bb892b7df..1cdfa208c 100644 --- a/lib/neatogen/stuff.c +++ b/lib/neatogen/stuff.c @@ -68,14 +68,13 @@ void free_array(double **rv) static double ***new_3array(int m, int n, int p, double ival) { - double ***rv; int i, j, k; - rv = N_NEW(m + 1, double **); + double ***rv = gv_calloc(m + 1, sizeof(double**)); for (i = 0; i < m; i++) { - rv[i] = N_NEW(n + 1, double *); + rv[i] = gv_calloc(n + 1, sizeof(double*)); for (j = 0; j < n; j++) { - rv[i][j] = N_NEW(p, double); + rv[i][j] = gv_calloc(p, sizeof(double)); for (k = 0; k < p; k++) rv[i][j][k] = ival; }