diff libinterp/corefcn/dasrt.cc @ 21118:3ac9f47fb04b

Invert pattern if/code/else/err_XXX to if !/err_XXX/code. * daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, load-save.cc, lsode.cc, quad.cc, xnorm.cc, xpow.cc, ov-base-diag.cc, ov-base-mat.cc, ov-base-scalar.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-cell.cc, ov-ch-mat.cc, ov-class.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-float.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-intx.h, ov-perm.cc, ov-range.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-struct.cc, ov.cc, pt-idx.cc, Array-util.cc, Array.cc, Sparse.cc, lo-specfun.cc, mx-inlines.cc, oct-binmap.h: Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
author Rik <rik@octave.org>
date Wed, 20 Jan 2016 16:08:30 -0800
parents e39e05d90788
children 90cd0f9442d5
line wrap: on
line diff
--- a/libinterp/corefcn/dasrt.cc	Wed Jan 20 15:45:58 2016 -0800
+++ b/libinterp/corefcn/dasrt.cc	Wed Jan 20 16:08:30 2016 -0800
@@ -84,20 +84,18 @@
           err_user_supplied_eval (e, "dasrt");
         }
 
-      if (tmp.length () > 0 && tmp(0).is_defined ())
+      if (tmp.length () < 1 || ! tmp(0).is_defined ())
+        err_user_supplied_eval ("dasrt");
+
+      if (! warned_fcn_imaginary && tmp(0).is_complex_type ())
         {
-          if (! warned_fcn_imaginary && tmp(0).is_complex_type ())
-            {
-              warning ("dasrt: ignoring imaginary part returned from user-supplied function");
-              warned_fcn_imaginary = true;
-            }
+          warning ("dasrt: ignoring imaginary part returned from user-supplied function");
+          warned_fcn_imaginary = true;
+        }
 
-          retval = tmp(0).vector_value ();
+      retval = tmp(0).vector_value ();
 
-          if (retval.is_empty ())
-            err_user_supplied_eval ("dasrt");
-        }
-      else
+      if (retval.is_empty ())
         err_user_supplied_eval ("dasrt");
     }
 
@@ -127,20 +125,18 @@
           err_user_supplied_eval (e, "dasrt");
         }
 
-      if (tmp.length () > 0 && tmp(0).is_defined ())
+      if (tmp.length () == 0 || ! tmp(0).is_defined ())
+        err_user_supplied_eval ("dasrt");
+
+      if (! warned_cf_imaginary && tmp(0).is_complex_type ())
         {
-          if (! warned_cf_imaginary && tmp(0).is_complex_type ())
-            {
-              warning ("dasrt: ignoring imaginary part returned from user-supplied constraint function");
-              warned_cf_imaginary = true;
-            }
+          warning ("dasrt: ignoring imaginary part returned from user-supplied constraint function");
+          warned_cf_imaginary = true;
+        }
 
-          retval = tmp(0).vector_value ();
+      retval = tmp(0).vector_value ();
 
-          if (retval.is_empty ())
-            err_user_supplied_eval ("dasrt");
-        }
-      else
+      if (retval.is_empty ())
         err_user_supplied_eval ("dasrt");
     }
 
@@ -176,20 +172,18 @@
         }
 
       int tlen = tmp.length ();
-      if (tlen > 0 && tmp(0).is_defined ())
+      if (tlen == 0 || ! tmp(0).is_defined ())
+        err_user_supplied_eval ("dasrt");
+
+      if (! warned_jac_imaginary && tmp(0).is_complex_type ())
         {
-          if (! warned_jac_imaginary && tmp(0).is_complex_type ())
-            {
-              warning ("dasrt: ignoring imaginary part returned from user-supplied jacobian function");
-              warned_jac_imaginary = true;
-            }
+          warning ("dasrt: ignoring imaginary part returned from user-supplied jacobian function");
+          warned_jac_imaginary = true;
+        }
 
-          retval = tmp(0).matrix_value ();
+      retval = tmp(0).matrix_value ();
 
-          if (retval.is_empty ())
-            err_user_supplied_eval ("dasrt");
-        }
-      else
+      if (retval.is_empty ())
         err_user_supplied_eval ("dasrt");
     }