From: Matthew Fernandez Date: Thu, 15 Sep 2022 00:58:56 +0000 (-0700) Subject: sparse SparseMatrix_weakly_connected_compone…: use cgraph wrapper for allocation X-Git-Tag: 6.0.2~35^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67b9f70c8e6ef06cf8e24b38a5ec92e2d2791efd;p=graphviz sparse SparseMatrix_weakly_connected_compone…: 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 df5ae3be8..cd984f1c7 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -1840,7 +1840,7 @@ void SparseMatrix_weakly_connected_components(SparseMatrix A0, int *ncomp, int * if (!SparseMatrix_is_symmetric(A, true)){ A = SparseMatrix_symmetrize(A, true); } - if (!(*comps_ptr)) *comps_ptr = MALLOC(sizeof(int)*((size_t)(m+1))); + if (!(*comps_ptr)) *comps_ptr = gv_calloc((size_t)(m + 1), sizeof(int)); *ncomp = 0; (*comps_ptr)[0] = 0;