From: Matthew Fernandez Date: Fri, 18 Nov 2022 01:14:41 +0000 (-0800) Subject: neatogen compute_new_weights: use cgraph wrappers for allocation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fa487c5f5e592fea16ec8807c41b1eb2f807e47;p=graphviz neatogen compute_new_weights: 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/kkutils.c b/lib/neatogen/kkutils.c index 0aa316772..8277d71cc 100644 --- a/lib/neatogen/kkutils.c +++ b/lib/neatogen/kkutils.c @@ -239,14 +239,13 @@ void compute_new_weights(vtx_data * graph, int n) int i, j; int nedges = 0; - float *weights; - int *vtx_vec = N_GNEW(n, int); + int *vtx_vec = gv_calloc(n, sizeof(int)); int deg_i, deg_j, neighbor; for (i = 0; i < n; i++) { nedges += graph[i].nedges; } - weights = N_GNEW(nedges, float); + float *weights = gv_calloc(nedges, sizeof(float)); for (i = 0; i < n; i++) { vtx_vec[i] = 0;