]> granicus.if.org Git - graphviz/commitdiff
sfdpgen Multilevel_init: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 10 Sep 2022 03:08:32 +0000 (20:08 -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 c03310f028e8cb9c018e1fe7e4100f1f7e30e298..6fe3cc943fee7fd0a4fcf9e141b19a6a60f2069a 100644 (file)
@@ -34,10 +34,9 @@ void Multilevel_control_delete(Multilevel_control ctrl){
 }
 
 static Multilevel Multilevel_init(SparseMatrix A, SparseMatrix D, double *node_weights){
-  Multilevel grid;
   if (!A) return NULL;
   assert(A->m == A->n);
-  grid = GNEW(struct Multilevel_struct);
+  Multilevel grid = gv_alloc(sizeof(struct Multilevel_struct));
   grid->level = 0;
   grid->n = A->n;
   grid->A = A;