From: Matthew Fernandez Date: Sun, 28 Aug 2022 19:33:02 +0000 (-0700) Subject: sfdpgen spring_electrical_control_new: use cgraph wrapper for allocation X-Git-Tag: 6.0.1~14^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ab2d1a2331ce6c0b825e3b0cfa9f91e43fdebaa;p=graphviz sfdpgen spring_electrical_control_new: 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 a692e6550..7da5e1e20 100644 --- a/lib/sfdpgen/spring_electrical.c +++ b/lib/sfdpgen/spring_electrical.c @@ -9,6 +9,7 @@ *************************************************************************/ #include "config.h" +#include #include #include #include @@ -30,7 +31,7 @@ spring_electrical_control spring_electrical_control_new(){ spring_electrical_control ctrl; - ctrl = MALLOC(sizeof(struct spring_electrical_control_struct)); + ctrl = gv_alloc(sizeof(struct spring_electrical_control_struct)); ctrl->p = AUTOP;/*a negativve number default to -1. repulsive force = dist^p */ ctrl->q = 1;/*a positive number default to 1. Only apply to maxent. attractive force = dist^q. Stress energy = (||x_i-x_j||-d_ij)^{q+1} */