From: Matthew Fernandez Date: Sun, 18 Sep 2022 17:13:57 +0000 (-0700) Subject: topfish coarsen_match: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~32^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c94125322cbe21e04025ef1cec2bbec01f6e1989;p=graphviz topfish coarsen_match: 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 7b9241d20..28f0038b4 100644 --- a/lib/topfish/hierarchy.c +++ b/lib/topfish/hierarchy.c @@ -588,7 +588,7 @@ coarsen_match ( int cnvtxs; /* Allocate and initialize space. */ - mflag = N_NEW(nvtxs, int); + mflag = gv_calloc(nvtxs, sizeof(int)); /* Find a maximal matching in the graphs */ nmerged = maxmatch(graph, geom_graph, nvtxs, mflag, dist2_limit); @@ -599,8 +599,8 @@ coarsen_match ( *cnp = cnvtxs = nvtxs - nmerged; - *v2cvp = v2cv = N_NEW(nvtxs, int); - *cv2vp = cv2v = N_NEW(2 * cnvtxs, int); + *v2cvp = v2cv = gv_calloc(nvtxs, sizeof(int)); + *cv2vp = cv2v = gv_calloc(2 * cnvtxs, sizeof(int)); makev2cv(mflag, nvtxs, v2cv, cv2v); free(mflag);