From f81fc8bc4c0bf0242dda53c42e63eaff1f4a3f9e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 18 Sep 2022 10:13:29 -0700 Subject: [PATCH] topfish make_coarse_ex_graph: 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. --- lib/topfish/hierarchy.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/topfish/hierarchy.c b/lib/topfish/hierarchy.c index 07f2dd55f..7b9241d20 100644 --- a/lib/topfish/hierarchy.c +++ b/lib/topfish/hierarchy.c @@ -493,20 +493,16 @@ make_coarse_ex_graph ( { int cnedges; /* number of edges in coarsened graph */ ex_vtx_data *cgraph; /* coarsened version of graph */ - int i, j, cv, v, neighbor, cv_nedges; - int *index = N_NEW(cnvtxs, int); + int j, cv, v, neighbor, cv_nedges; + int *index = gv_calloc(cnvtxs, sizeof(int)); int *edges; - for (i = 0; i < cnvtxs; i++) { - index[i] = 0; - } - /* An upper bound on the number of coarse graph edges. */ cnedges = nedges; /* Now allocate space for the new graph. Overeallocate and realloc later. */ - cgraph = N_NEW(cnvtxs, ex_vtx_data); - edges = N_NEW(2 * cnedges + cnvtxs, int); + cgraph = gv_calloc(cnvtxs, sizeof(ex_vtx_data)); + edges = gv_calloc(2 * cnedges + cnvtxs, sizeof(int)); for (cv = 0; cv < cnvtxs; cv++) { -- 2.50.1