]> granicus.if.org Git - graphviz/commitdiff
neatogen print_bounding_box: use cgraph wrappers for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 7 Oct 2022 02:37:52 +0000 (19:37 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 11 Oct 2022 00:40:54 +0000 (17:40 -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/neatogen/overlap.c

index 7d6b3fead560bc14b313abbfabf838e7f7d9f351..a023677f8b2c442a76a212f50baacdbf2037cc67 100644 (file)
@@ -19,7 +19,6 @@
 #include <rbtree/red_black_tree.h>
 #include <common/types.h>
 #include <math.h>
-#include <common/memory.h>
 #include <common/globals.h>
 #include <stdbool.h>
 #include <time.h>
@@ -507,11 +506,10 @@ static void scale_to_edge_length(int dim, SparseMatrix A, double *x, double avg_
 }
 
 static void print_bounding_box(int n, int dim, double *x){
-  double *xmin, *xmax;
   int i, k;
 
-  xmin = N_GNEW(dim,double);
-  xmax = N_GNEW(dim,double);
+  double *xmin = gv_calloc(dim, sizeof(double));
+  double *xmax = gv_calloc(dim, sizeof(double));
 
   for (i = 0; i < dim; i++) xmin[i]=xmax[i] = x[i];