]> granicus.if.org Git - graphviz/commitdiff
sfdpgen spring_electrical_control_new: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 28 Aug 2022 19:33:02 +0000 (12:33 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 31 Aug 2022 00:11:33 +0000 (17:11 -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 a692e6550959704d07591a747e73dee7d6404f31..7da5e1e209a15ea94ef32bec8b3ce8a8703f343c 100644 (file)
@@ -9,6 +9,7 @@
  *************************************************************************/
 
 #include "config.h"
+#include <cgraph/alloc.h>
 #include <cgraph/bitarray.h>
 #include <sparse/SparseMatrix.h>
 #include <sfdpgen/spring_electrical.h>
@@ -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} */