From: Matthew Fernandez Date: Thu, 15 Sep 2022 01:09:07 +0000 (-0700) Subject: sparse SparseMatrix_decompose_to_supervari…: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~35^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2b1c6ece6ba8c1fb2e0d5491ce5bd640951cd49;p=graphviz sparse SparseMatrix_decompose_to_supervari…: 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/sparse/SparseMatrix.c b/lib/sparse/SparseMatrix.c index 159ec4e96..5f1a85744 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -2013,10 +2013,10 @@ void SparseMatrix_decompose_to_supervariables(SparseMatrix A, int *ncluster, int int *ia = A->ia, *ja = A->ja, n = A->n, m = A->m; int *super = NULL, *nsuper = NULL, i, j, *mask = NULL, isup, *newmap, isuper; - super = MALLOC(sizeof(int)*((size_t)(n))); - nsuper = MALLOC(sizeof(int)*((size_t)(n+1))); - mask = MALLOC(sizeof(int)*((size_t)n)); - newmap = MALLOC(sizeof(int)*((size_t)n)); + super = gv_calloc((size_t)n, sizeof(int)); + nsuper = gv_calloc((size_t)(n + 1), sizeof(int)); + mask = gv_calloc((size_t)n, sizeof(int)); + newmap = gv_calloc((size_t)n, sizeof(int)); nsuper++; isup = 0;