From: Matthew Fernandez Date: Sat, 10 Sep 2022 03:14:38 +0000 (-0700) Subject: sfdpgen Multilevel_coarsen_internal: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~44^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ed4e6a7e76a72722d92f00e4247fa4b856aa932;p=graphviz sfdpgen Multilevel_coarsen_internal: 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/sfdpgen/Multilevel.c b/lib/sfdpgen/Multilevel.c index 7de0060d0..acbda7689 100644 --- a/lib/sfdpgen/Multilevel.c +++ b/lib/sfdpgen/Multilevel.c @@ -10,7 +10,6 @@ #include #include -#include #include #include #include @@ -889,9 +888,9 @@ static void Multilevel_coarsen_internal(SparseMatrix A, SparseMatrix *cA, Sparse #endif goto RETURN; } - irn = N_GNEW(n,int); - jcn = N_GNEW(n,int); - val = N_GNEW(n,double); + irn = gv_calloc(n, sizeof(int)); + jcn = gv_calloc(n, sizeof(int)); + val = gv_calloc(n, sizeof(double)); nzc = 0; for (i = 0; i < ncluster; i++){ for (j = clusterp[i]; j < clusterp[i+1]; j++){ @@ -942,9 +941,9 @@ static void Multilevel_coarsen_internal(SparseMatrix A, SparseMatrix *cA, Sparse #endif goto RETURN; } - irn = N_GNEW(n,int); - jcn = N_GNEW(n,int); - val = N_GNEW(n,double); + irn = gv_calloc(n, sizeof(int)); + jcn = gv_calloc(n, sizeof(int)); + val = gv_calloc(n, sizeof(double)); nzc = 0; nc = 0; for (i = 0; i < n; i++){ if (matching[i] >= 0){ @@ -1004,9 +1003,9 @@ static void Multilevel_coarsen_internal(SparseMatrix A, SparseMatrix *cA, Sparse #endif goto RETURN; } - irn = N_GNEW(nzc,int); - jcn = N_GNEW(nzc,int); - val = N_GNEW(nzc,double); + irn = gv_calloc(nzc, sizeof(int)); + jcn = gv_calloc(nzc, sizeof(int)); + val = gv_calloc(nzc, sizeof(double)); nzc = 0; for (i = 0; i < n; i++){ if (vset[i] == MAX_IND_VTX_SET_F){