From: Matthew Fernandez Date: Fri, 18 Nov 2022 01:14:41 +0000 (-0800) Subject: neatogen getSizes: use cgraph wrappers for allocation X-Git-Tag: 7.0.3~1^2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae32926dec972043796c2ae0e29ce5e97516534c;p=graphviz neatogen getSizes: 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/adjust.c b/lib/neatogen/adjust.c index 4e3d47612..0a6b96532 100644 --- a/lib/neatogen/adjust.c +++ b/lib/neatogen/adjust.c @@ -629,9 +629,8 @@ static void updateGraph(void) double *getSizes(Agraph_t * g, pointf pad, int* n_elabels, int** elabels) { Agnode_t *n; - double *sizes = N_GNEW(Ndim * agnnodes(g), double); + double *sizes = gv_calloc(Ndim * agnnodes(g), sizeof(double)); int i, nedge_nodes = 0; - int* elabs; for (n = agfstnode(g); n; n = agnxtnode(g, n)) { if (elabels && IS_LNODE(n)) nedge_nodes++; @@ -642,7 +641,7 @@ double *getSizes(Agraph_t * g, pointf pad, int* n_elabels, int** elabels) } if (elabels && nedge_nodes) { - elabs = N_GNEW(nedge_nodes, int); + int* elabs = gv_calloc(nedge_nodes, sizeof(int)); nedge_nodes = 0; for (n = agfstnode(g); n; n = agnxtnode(g, n)) { if (IS_LNODE(n))