]> granicus.if.org Git - graphviz/commitdiff
sparse SparseMatrix_get_real_adjacency_matri…: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 15 Sep 2022 00:57:50 +0000 (17:57 -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 75ea17e226bae04c1c79f072de66aa8a6925cd77..fe9eb9e17ee96c52f4d137a2a56609c918aad95e 100644 (file)
@@ -1712,7 +1712,7 @@ SparseMatrix SparseMatrix_get_real_adjacency_matrix_symmetrized(SparseMatrix A){
   A = SparseMatrix_symmetrize(B, true);
   SparseMatrix_delete(B);
   A = SparseMatrix_remove_diagonal(A);
-  A->a = MALLOC(sizeof(double)*((size_t)(A->nz)));
+  A->a = gv_calloc((size_t)A->nz, sizeof(double));
   a = (double*) A->a;
   for (i = 0; i < A->nz; i++) a[i] = 1.;
   A->type = MATRIX_TYPE_REAL;