From 7ab2d1a2331ce6c0b825e3b0cfa9f91e43fdebaa Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 28 Aug 2022 12:33:02 -0700 Subject: [PATCH] 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. --- lib/sfdpgen/spring_electrical.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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} */ -- 2.50.1