From: Matthew Fernandez Date: Thu, 15 Sep 2022 00:58:32 +0000 (-0700) Subject: sparse SparseMatrix_level_sets_internal: use cgraph wrapper for allocation X-Git-Tag: 6.0.2~35^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=869a8e8e1bc7fb3fd4259d29e666483f04e35156;p=graphviz sparse SparseMatrix_level_sets_internal: use cgraph wrapper 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 fe9eb9e17..df5ae3be8 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -1782,8 +1782,8 @@ static void SparseMatrix_level_sets_internal(int khops, SparseMatrix A, int root int i, j, sta = 0, sto = 1, nz, ii; int m = A->m, *ia = A->ia, *ja = A->ja; - if (!(*levelset_ptr)) *levelset_ptr = MALLOC(sizeof(int)*((size_t)(m+2))); - if (!(*levelset)) *levelset = MALLOC(sizeof(int)*((size_t)m)); + if (!(*levelset_ptr)) *levelset_ptr = gv_calloc((size_t)(m + 2), sizeof(int)); + if (!(*levelset)) *levelset = gv_calloc((size_t)m, sizeof(int)); if (!(*mask)) { *mask = gv_calloc((size_t)m, sizeof(int)); for (i = 0; i < m; i++) (*mask)[i] = UNMASKED;