From: Matthew Fernandez Date: Sat, 10 Sep 2022 03:42:18 +0000 (-0700) Subject: sfdpgen power_law_graph: use cgraph wrapper for allocation X-Git-Tag: 6.0.2~44^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4009fccab2ae5c56dc7bb2c6b51acd5c581fc7d8;p=graphviz sfdpgen power_law_graph: 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/sfdpgen/spring_electrical.c b/lib/sfdpgen/spring_electrical.c index 9abeef17e..5c9f32ba5 100644 --- a/lib/sfdpgen/spring_electrical.c +++ b/lib/sfdpgen/spring_electrical.c @@ -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;