From 311361c4288758ed7394b9dd00eb69b7b89bb425 Mon Sep 17 00:00:00 2001
From: Matthew Fernandez <matthew.fernandez@gmail.com>
Date: Thu, 6 Oct 2022 19:37:07 -0700
Subject: [PATCH] neatogen OverlapSmoother_new: use cgraph wrappers 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/neatogen/overlap.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/neatogen/overlap.c b/lib/neatogen/overlap.c
index 015449874..7d6b3fead 100644
--- a/lib/neatogen/overlap.c
+++ b/lib/neatogen/overlap.c
@@ -366,14 +366,13 @@ OverlapSmoother OverlapSmoother_new(SparseMatrix A, int m,
 				    double *max_overlap, double *min_overlap,
 				    int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, int shrink
 				    ){
-  OverlapSmoother sm;
   int i, j, k, *iw, *jw, jdiag;
   SparseMatrix B;
-  double *lambda, *d, *w, diag_d, diag_w, dist;
+  double *d, *w, diag_d, diag_w, dist;
 
   assert((!A) || SparseMatrix_is_symmetric(A, false));
 
-  sm = GNEW(struct OverlapSmoother_struct);
+  OverlapSmoother sm = gv_alloc(sizeof(struct OverlapSmoother_struct));
   sm->scheme = SM_SCHEME_NORMAL;
   if (constr_nodes && n_constr_nodes > 0 && edge_labeling_scheme != ELSCHEME_NONE){
     sm->scheme = SM_SCHEME_NORMAL_ELABEL;
@@ -386,7 +385,7 @@ OverlapSmoother OverlapSmoother_new(SparseMatrix A, int m,
   sm->tol_cg = 0.01;
   sm->maxit_cg = sqrt((double) A->m);
 
-  lambda = sm->lambda = N_GNEW(m,double);
+  double *lambda = sm->lambda = gv_calloc(m, sizeof(double));
   for (i = 0; i < m; i++) sm->lambda[i] = lambda0;
   
   B= call_tri(m, x);
-- 
2.40.0