]> granicus.if.org Git - graphviz/commitdiff
sfdpgen power_law_graph: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 10 Sep 2022 03:42:18 +0000 (20:42 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 11 Sep 2022 23:56:02 +0000 (16:56 -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/sfdpgen/spring_electrical.c

index 9abeef17e947cff6b0e82ee9620d473392ef27f9..5c9f32ba50b08ab234ece744d116c0efa26ac8b3 100644 (file)
@@ -1626,10 +1626,10 @@ static void prolongate(int dim, SparseMatrix A, SparseMatrix P, SparseMatrix R,
 
 
 int power_law_graph(SparseMatrix A){
-  int *mask, m, max = 0, i, *ia = A->ia, *ja = A->ja, j, deg;
+  int m, max = 0, i, *ia = A->ia, *ja = A->ja, j, deg;
   int res = FALSE;
   m = A->m;
-  mask = MALLOC(sizeof(int)*(m+1));
+  int *mask = gv_calloc(m + 1, sizeof(int));
 
   for (i = 0; i < m + 1; i++){
     mask[i] = 0;