From: Matthew Fernandez Date: Sun, 18 Sep 2022 17:12:14 +0000 (-0700) Subject: topfish maxmatch: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~32^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01aa6d376df45fe47bdaf616979abe5b4921439b;p=graphviz topfish maxmatch: 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/topfish/hierarchy.c b/lib/topfish/hierarchy.c index 7ae51bdf9..01c6762d7 100644 --- a/lib/topfish/hierarchy.c +++ b/lib/topfish/hierarchy.c @@ -16,6 +16,7 @@ // // /////////////////////////////////////// +#include #include #include #include @@ -154,12 +155,12 @@ maxmatch(v_data * graph, /* array of vtx data for graph */ int i, j; /* loop counters */ float max_norm_edge_weight; double inv_size; - double *matchability = N_NEW(nvtxs, double); + double *matchability = gv_calloc(nvtxs, sizeof(double)); double min_edge_len; double closest_val = -1, val; int closest_neighbor; - float *vtx_vec = N_NEW(nvtxs, float); - float *weighted_vtx_vec = N_NEW(nvtxs, float); + float *vtx_vec = gv_calloc(nvtxs, sizeof(float)); + float *weighted_vtx_vec = gv_calloc(nvtxs, sizeof(float)); // gather statistics, to enable normalizing the values double avg_edge_len = 0, avg_deg_2 = 0; @@ -199,7 +200,7 @@ maxmatch(v_data * graph, /* array of vtx data for graph */ } /* Now determine the order of the vertices. */ - iptr = order = N_NEW(nvtxs, int); + iptr = order = gv_calloc(nvtxs, sizeof(int)); jptr = mflag; for (i = 0; i < nvtxs; i++) { *(iptr++) = i;