]> granicus.if.org Git - graphviz/commitdiff
sfdpgen Multilevel_control_new: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 10 Sep 2022 03:07:41 +0000 (20:07 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 11 Sep 2022 23:56:02 +0000 (16:56 -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/Multilevel.c

index d6f5bb3745dd1ac8412212bc00324b6cf77322a3..c03310f028e8cb9c018e1fe7e4100f1f7e30e298 100644 (file)
 #include <sfdpgen/PriorityQueue.h>
 #include <common/memory.h>
 #include <assert.h>
+#include <cgraph/alloc.h>
 #include <common/arith.h>
 #include <stddef.h>
 #include <stdbool.h>
 
 Multilevel_control Multilevel_control_new(void) {
-  Multilevel_control ctrl;
-
-  ctrl = GNEW(struct Multilevel_control_struct);
+  Multilevel_control ctrl = gv_alloc(sizeof(struct Multilevel_control_struct));
   ctrl->minsize = 4;
   ctrl->min_coarsen_factor = 0.75;
   ctrl->maxlevel = 1<<30;