From: Matthew Fernandez Date: Thu, 15 Sep 2022 01:14:34 +0000 (-0700) Subject: sparse SparseMatrix_distance_matrix_khops: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~35^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22f4c44fd8157bccb92cfb41f6599c65040867c8;p=graphviz sparse SparseMatrix_distance_matrix_khops: 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 922e30d3a..c4b49208c 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -2452,8 +2451,8 @@ SparseMatrix SparseMatrix_distance_matrix_khops(int khops, SparseMatrix D0, int } } } else { - list = MALLOC(sizeof(int)*n); - dist = MALLOC(sizeof(double)*n); + list = gv_calloc(n, sizeof(int)); + dist = gv_calloc(n, sizeof(double)); /* Dijkstra_khops(khops, D, 60, dist, &nlist, list, &dmax); for (j = 0; j < nlist; j++){