]> granicus.if.org Git - graphviz/commitdiff
sparse SparseMatrix_decompose_to_supervari…: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 15 Sep 2022 01:09:07 +0000 (18:09 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 20 Sep 2022 14:36:59 +0000 (07:36 -0700)
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.

lib/sparse/SparseMatrix.c

index 159ec4e96106546c761774ea4284c269ca5f1088..5f1a8574494e4fa3d723778bb33454afa5b53c27 100644 (file)
@@ -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;