changeset 27113:c3d5afa00588

eliminate obsolete global variable * Quad.h, Quad.cc (quad_integration_error): Eliminate obsolete global variable. Now that errors in user-supplied integrand functions are handled with exceptions, not code sets quad_integration_error to anything but 0.
author John W. Eaton <jwe@octave.org>
date Fri, 24 May 2019 18:12:34 +0000
parents 2e5d8cdc7087
children 85233937b6b7
files liboctave/numeric/Quad.cc liboctave/numeric/Quad.h
diffstat 2 files changed, 2 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/numeric/Quad.cc	Fri May 24 17:55:48 2019 +0000
+++ b/liboctave/numeric/Quad.cc	Fri May 24 18:12:34 2019 +0000
@@ -35,11 +35,6 @@
 static integrand_fcn user_fcn;
 static float_integrand_fcn float_user_fcn;
 
-// FIXME: would be nice to not have to have this global variable.
-// Nonzero means an error occurred in the calculation of the integrand
-// function, and the user wants us to quit.
-int quad_integration_error = 0;
-
 typedef F77_INT (*quad_fcn_ptr) (const double&, int&, double&);
 typedef F77_INT (*quad_float_fcn_ptr) (const float&, int&, float&);
 
@@ -79,28 +74,18 @@
 }
 
 static F77_INT
-user_function (const double& x, int& ierr, double& result)
+user_function (const double& x, int&, double& result)
 {
-  quad_integration_error = 0;
-
   result = (*user_fcn) (x);
 
-  if (quad_integration_error)
-    ierr = -1;
-
   return 0;
 }
 
 static F77_INT
-float_user_function (const float& x, int& ierr, float& result)
+float_user_function (const float& x, int&, float& result)
 {
-  quad_integration_error = 0;
-
   result = (*float_user_fcn) (x);
 
-  if (quad_integration_error)
-    ierr = -1;
-
   return 0;
 }
 
--- a/liboctave/numeric/Quad.h	Fri May 24 17:55:48 2019 +0000
+++ b/liboctave/numeric/Quad.h	Fri May 24 18:12:34 2019 +0000
@@ -31,11 +31,6 @@
 typedef double (*integrand_fcn) (double x);
 typedef float (*float_integrand_fcn) (float x);
 
-// FIXME: would be nice to not have to have this global variable.
-// Nonzero means an error occurred in the calculation of the integrand
-// function, and the user wants us to quit.
-extern OCTAVE_API int quad_integration_error;
-
 #include "Quad-opts.h"
 
 class