Hi list,

in reference to my previous email I dug through the whole code base, checking
each function that the 'git grep -n -p "GSL_ERROR_NULL"' returned.  Thankfully,
only a couple of more functions turned up which use GSL_ERROR_NULL instead of
GSL_ERROR. Although this might not seem relevant at first, remember that
GSL_SUCCESS equals to 0 as does NULL returned by GSL_ERROR_NULL, so there's no
way of knowing that those functions might fail if you use a custom error handler
which doesn't automatically abort.

Anyway, patch attached. If you prefer pull requests instead, let me know.

Cheers,

  Matthias
diff --git a/contrib/jsqrng-sobol.c b/contrib/jsqrng-sobol.c
index f70f1fd..145132e 100644
--- a/contrib/jsqrng-sobol.c
+++ b/contrib/jsqrng-sobol.c
@@ -84,11 +84,11 @@ static int sobol_init(void * state, unsigned int dimension)
   { /* initialize degree_table, primitive_polynomials, max_degree and includ 
*/     
     degree_table = (int *) malloc(sizeof(int) * dimension); 
     if (degree_table==0) 
-      GSL_ERROR_NULL ("allocation of degree table failed for sobol init", 
GSL_ENOMEM); 
+      GSL_ERROR ("allocation of degree table failed for sobol init", 
GSL_ENOMEM);
     primitive_polynomials = (int *) malloc(sizeof(int) * dimension); 
     if (primitive_polynomials==0) {
       free(degree_table); 
-      GSL_ERROR_NULL ("allocation of primitives failed for sobol init", 
GSL_ENOMEM); 
+      GSL_ERROR ("allocation of primitives failed for sobol init", GSL_ENOMEM);
     }
 
     /* Generate the primitive polynomials */ 
@@ -99,7 +99,7 @@ static int sobol_init(void * state, unsigned int dimension)
     if (includ==0) {
       free(degree_table); 
       free(primitive_polynomials); 
-      GSL_ERROR_NULL ("allocation of 'includ' failed for sobol init", 
GSL_ENOMEM); 
+      GSL_ERROR ("allocation of 'includ' failed for sobol init", GSL_ENOMEM);
     }
   }
 
diff --git a/contrib/jsqrng_niederreiter-2.c b/contrib/jsqrng_niederreiter-2.c
index 4062f13..2ded9dd 100644
--- a/contrib/jsqrng_niederreiter-2.c
+++ b/contrib/jsqrng_niederreiter-2.c
@@ -216,7 +216,7 @@ static int calculate_cj(nied2_state_t * ns,  int dimension)
   primitive_polynomials = (int *) malloc(sizeof(int) * (1+dimension)); 
 
   if (poly_degree==0 || primitive_polynomials==0) 
-    GSL_ERROR_NULL ("allocation of degree table failed for niederreiter init", 
GSL_ENOMEM); 
+    GSL_ERROR ("allocation of degree table failed for niederreiter init", 
GSL_ENOMEM);
   
   /* Generate the primitive polynomials.  */ 
   get_primitive_polynomials(dimension, poly_degree+1, 
primitive_polynomials+1); 
@@ -233,7 +233,7 @@ static int calculate_cj(nied2_state_t * ns,  int dimension)
   px = (int *) malloc(sizeof(int) * (1+max_degree)); 
 
   if (v==0 || pb==0 || px==0) 
-    GSL_ERROR_NULL ("allocation of degree table failed for niederreiter init", 
GSL_ENOMEM); 
+    GSL_ERROR ("allocation of degree table failed for niederreiter init", 
GSL_ENOMEM);
 
   for(i_dim=0; i_dim<dimension; i_dim++) {
 
diff --git a/ode-initval2/control.c b/ode-initval2/control.c
index 4a09b81..e05bb3c 100644
--- a/ode-initval2/control.c
+++ b/ode-initval2/control.c
@@ -100,7 +100,7 @@ gsl_odeiv2_control_set_driver (gsl_odeiv2_control * c,
     }
   else
     {
-      GSL_ERROR_NULL ("driver pointer is null", GSL_EFAULT);
+      GSL_ERROR ("driver pointer is null", GSL_EFAULT);
     }
 
   return GSL_SUCCESS;
diff --git a/ode-initval2/cscal.c b/ode-initval2/cscal.c
index 420d86a..fe1e56e 100644
--- a/ode-initval2/cscal.c
+++ b/ode-initval2/cscal.c
@@ -162,7 +162,7 @@ sc_control_errlevel (void *vstate, const double y, const 
double dydt,
 
   if (*errlev <= 0.0)
     {
-      GSL_ERROR_NULL ("errlev <= zero", GSL_ESANITY);
+      GSL_ERROR ("errlev <= zero", GSL_ESANITY);
     }
 
   return GSL_SUCCESS;
diff --git a/ode-initval2/cstd.c b/ode-initval2/cstd.c
index 6b6833a..d4a45f4 100644
--- a/ode-initval2/cstd.c
+++ b/ode-initval2/cstd.c
@@ -157,7 +157,7 @@ std_control_errlevel (void *vstate, const double y, const 
double dydt,
 
   if (*errlev <= 0.0)
     {
-      GSL_ERROR_NULL ("errlev <= zero", GSL_ESANITY);
+      GSL_ERROR ("errlev <= zero", GSL_ESANITY);
     }
 
   return GSL_SUCCESS;
diff --git a/ode-initval2/driver.c b/ode-initval2/driver.c
index d0db988..540b208 100644
--- a/ode-initval2/driver.c
+++ b/ode-initval2/driver.c
@@ -108,7 +108,7 @@ gsl_odeiv2_driver_set_hmin (gsl_odeiv2_driver * d, const 
double hmin)
 
   if ((fabs (hmin) > fabs (d->h)) || (fabs (hmin) > d->hmax))
     {
-      GSL_ERROR_NULL ("hmin <= fabs(h) <= hmax required", GSL_EINVAL);
+      GSL_ERROR ("hmin <= fabs(h) <= hmax required", GSL_EINVAL);
     }
 
   d->hmin = fabs (hmin);
@@ -124,7 +124,7 @@ gsl_odeiv2_driver_set_hmax (gsl_odeiv2_driver * d, const 
double hmax)
 
   if ((fabs (hmax) < fabs (d->h)) || (fabs (hmax) < d->hmin))
     {
-      GSL_ERROR_NULL ("hmin <= fabs(h) <= hmax required", GSL_EINVAL);
+      GSL_ERROR ("hmin <= fabs(h) <= hmax required", GSL_EINVAL);
     }
 
   if (hmax > 0.0 || hmax < 0.0)
@@ -133,7 +133,7 @@ gsl_odeiv2_driver_set_hmax (gsl_odeiv2_driver * d, const 
double hmax)
     }
   else
     {
-      GSL_ERROR_NULL ("invalid hmax", GSL_EINVAL);
+      GSL_ERROR ("invalid hmax", GSL_EINVAL);
     }
 
   return GSL_SUCCESS;
@@ -349,7 +349,7 @@ gsl_odeiv2_driver_apply (gsl_odeiv2_driver * d, double *t,
 
   if (sign * (t1 - *t) < 0.0)
     {
-      GSL_ERROR_NULL
+      GSL_ERROR
         ("integration limits and/or step direction not consistent",
          GSL_EINVAL);
     }
@@ -461,7 +461,7 @@ gsl_odeiv2_driver_reset_hstart (gsl_odeiv2_driver * d, 
const double hstart)
 
   if ((d->hmin > fabs (hstart)) || (fabs (hstart) > d->hmax))
     {
-      GSL_ERROR_NULL ("hmin <= fabs(h) <= hmax required", GSL_EINVAL);
+      GSL_ERROR ("hmin <= fabs(h) <= hmax required", GSL_EINVAL);
     }
 
   if (hstart > 0.0 || hstart < 0.0)
@@ -470,7 +470,7 @@ gsl_odeiv2_driver_reset_hstart (gsl_odeiv2_driver * d, 
const double hstart)
     }
   else
     {
-      GSL_ERROR_NULL ("invalid hstart", GSL_EINVAL);
+      GSL_ERROR ("invalid hstart", GSL_EINVAL);
     }
 
   return GSL_SUCCESS;
diff --git a/ode-initval2/evolve.c b/ode-initval2/evolve.c
index c104b72..834a8da 100644
--- a/ode-initval2/evolve.c
+++ b/ode-initval2/evolve.c
@@ -382,7 +382,7 @@ gsl_odeiv2_evolve_set_driver (gsl_odeiv2_evolve * e,
     }
   else
     {
-      GSL_ERROR_NULL ("driver pointer is null", GSL_EFAULT);
+      GSL_ERROR ("driver pointer is null", GSL_EFAULT);
     }
 
   return GSL_SUCCESS;
diff --git a/ode-initval2/msadams.c b/ode-initval2/msadams.c
index 3c3342c..25c8f1a 100644
--- a/ode-initval2/msadams.c
+++ b/ode-initval2/msadams.c
@@ -970,7 +970,7 @@ msadams_apply (void *vstate, size_t dim, double t, double h,
   if (deltaord > 1 || deltaord < -1)
     {
       printf ("-- order change %d\n", deltaord);
-      GSL_ERROR_NULL ("msadams_apply too large order change", GSL_ESANITY);
+      GSL_ERROR ("msadams_apply too large order change", GSL_ESANITY);
     }
 
   /* Modify Nordsieck matrix if order or step length has been changed */
diff --git a/ode-initval2/msbdf.c b/ode-initval2/msbdf.c
index e66abc0..14979cf 100644
--- a/ode-initval2/msbdf.c
+++ b/ode-initval2/msbdf.c
@@ -1359,7 +1359,7 @@ msbdf_apply (void *vstate, size_t dim, double t, double h,
   if (deltaord > 1 || deltaord < -1)
     {
       printf ("-- order change %d\n", deltaord);
-      GSL_ERROR_NULL ("msbdf_apply too large order change", GSL_ESANITY);
+      GSL_ERROR ("msbdf_apply too large order change", GSL_ESANITY);
     }
 
   /* Modify Nordsieck matrix if order or step length has been changed */
diff --git a/ode-initval2/step.c b/ode-initval2/step.c
index 4c67037..0ee5421 100644
--- a/ode-initval2/step.c
+++ b/ode-initval2/step.c
@@ -97,7 +97,7 @@ gsl_odeiv2_step_set_driver (gsl_odeiv2_step * s, const 
gsl_odeiv2_driver * d)
     }
   else
     {
-      GSL_ERROR_NULL ("driver pointer is null", GSL_EFAULT);
+      GSL_ERROR ("driver pointer is null", GSL_EFAULT);
     }
 
   return GSL_SUCCESS;

Reply via email to