From: Matthew Fernandez Date: Sat, 10 Sep 2022 03:39:15 +0000 (-0700) Subject: sfdpgen spring_electrical_embedding_fast: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~44^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fa241a6278496f59c636fca4d4a1d6877aaf6a5;p=graphviz sfdpgen spring_electrical_embedding_fast: 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/sfdpgen/spring_electrical.c b/lib/sfdpgen/spring_electrical.c index a9c56b366..2f19b3d3b 100644 --- a/lib/sfdpgen/spring_electrical.c +++ b/lib/sfdpgen/spring_electrical.c @@ -522,8 +522,8 @@ void spring_electrical_embedding_fast(int dim, SparseMatrix A0, spring_electrica KP = pow(K, 1 - p); CRK = pow(C, (2.-p)/3.)/K; - xold = MALLOC(sizeof(double)*dim*n); - force = MALLOC(sizeof(double)*dim*n); + xold = gv_calloc(dim * n, sizeof(double)); + force = gv_calloc(dim * n, sizeof(double)); do { #ifdef TIME