From 78a83edabfdd3cd59e3c4d6a5ddb74693dbe60b2 Mon Sep 17 00:00:00 2001 From: David Parkhurst Date: Tue, 23 Mar 2021 19:35:54 -0600 Subject: [PATCH] c,d in polint --- integrate.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/integrate.cpp b/integrate.cpp index f38a334c..d1eb4bbd 100644 --- a/integrate.cpp +++ b/integrate.cpp @@ -298,21 +298,15 @@ polint(LDBLE * xa, LDBLE * ya, int n, LDBLE xv, LDBLE * yv, LDBLE * dy) { int i, m, ns; LDBLE den, dif, dift, ho, hp, w; - LDBLE *c, *d; ns = 1; dif = fabs(xv - xa[1]); /* * Malloc work space */ - c = (LDBLE *) PHRQ_malloc(((size_t)n + 1) * sizeof(LDBLE)); - if (c == NULL) - malloc_error(); - d = (LDBLE *) PHRQ_malloc(((size_t)n + 1) * sizeof(LDBLE)); - if (d == NULL) - malloc_error(); - - + std::vector c, d; + c.resize((size_t)n + 1); + d.resize((size_t)n + 1); for (i = 1; i <= n; i++) { @@ -354,8 +348,6 @@ polint(LDBLE * xa, LDBLE * ya, int n, LDBLE xv, LDBLE * yv, LDBLE * dy) /* *yv += (*dy = (2 * ns < (n-m) ? c[ns+1] : d[ns--])); */ } - c = (LDBLE *) free_check_null(c); - d = (LDBLE *) free_check_null(d); return; }