diff libinterp/corefcn/find.cc @ 20589:b10432a40432

eliminate more simple uses of error_state * dasrt.cc, debug.cc, find.cc, gammainc.cc, matrix_type.cc, ov-usr-fcn.cc, pt-assign.cc, pt-binop.cc: Eliminate simple uses of error_state.
author John W. Eaton <jwe@octave.org>
date Mon, 05 Oct 2015 20:37:19 -0400
parents dd6345fd8a97
children
line wrap: on
line diff
--- a/libinterp/corefcn/find.cc	Mon Oct 05 20:21:55 2015 -0400
+++ b/libinterp/corefcn/find.cc	Mon Oct 05 20:37:19 2015 -0400
@@ -424,13 +424,10 @@
 
       std::string s_arg = args(2).string_value ();
 
-      if (! error_state)
-        {
-          if (s_arg == "first")
-            direction = 1;
-          else if (s_arg == "last")
-            direction = -1;
-        }
+      if (s_arg == "first")
+        direction = 1;
+      else if (s_arg == "last")
+        direction = -1;
 
       if (direction == 0)
         {
@@ -447,9 +444,7 @@
         {
           SparseBoolMatrix v = arg.sparse_bool_matrix_value ();
 
-          if (! error_state)
-            retval = find_nonzero_elem_idx (v, nargout,
-                                            n_to_find, direction);
+          retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction);
         }
       else if (nargout <= 1 && n_to_find == -1 && direction == 1)
         {
@@ -466,9 +461,7 @@
         {
           boolNDArray v = arg.bool_array_value ();
 
-          if (! error_state)
-            retval = find_nonzero_elem_idx (v, nargout,
-                                            n_to_find, direction);
+          retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction);
         }
     }
   else if (arg.is_integer_type ())
@@ -477,10 +470,8 @@
       else if (arg.is_ ## INTT ## _type ()) \
         { \
           INTT ## NDArray v = arg.INTT ## _array_value (); \
-          \
-          if (! error_state) \
-            retval = find_nonzero_elem_idx (v, nargout, \
-                                            n_to_find, direction);\
+ \
+          retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction); \
         }
 
       if (false)
@@ -502,17 +493,13 @@
         {
           SparseMatrix v = arg.sparse_matrix_value ();
 
-          if (! error_state)
-            retval = find_nonzero_elem_idx (v, nargout,
-                                            n_to_find, direction);
+          retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction);
         }
       else if (arg.is_complex_type ())
         {
           SparseComplexMatrix v = arg.sparse_complex_matrix_value ();
 
-          if (! error_state)
-            retval = find_nonzero_elem_idx (v, nargout,
-                                            n_to_find, direction);
+          retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction);
         }
       else
         gripe_wrong_type_arg ("find", arg);
@@ -521,15 +508,13 @@
     {
       PermMatrix P = arg.perm_matrix_value ();
 
-      if (! error_state)
-        retval = find_nonzero_elem_idx (P, nargout, n_to_find, direction);
+      retval = find_nonzero_elem_idx (P, nargout, n_to_find, direction);
     }
   else if (arg.is_string ())
     {
       charNDArray chnda = arg.char_array_value ();
 
-      if (! error_state)
-        retval = find_nonzero_elem_idx (chnda, nargout, n_to_find, direction);
+      retval = find_nonzero_elem_idx (chnda, nargout, n_to_find, direction);
     }
   else if (arg.is_single_type ())
     {
@@ -537,32 +522,26 @@
         {
           FloatNDArray nda = arg.float_array_value ();
 
-          if (! error_state)
-            retval = find_nonzero_elem_idx (nda, nargout, n_to_find,
-                                            direction);
+          retval = find_nonzero_elem_idx (nda, nargout, n_to_find, direction);
         }
       else if (arg.is_complex_type ())
         {
           FloatComplexNDArray cnda = arg.float_complex_array_value ();
 
-          if (! error_state)
-            retval = find_nonzero_elem_idx (cnda, nargout, n_to_find,
-                                            direction);
+          retval = find_nonzero_elem_idx (cnda, nargout, n_to_find, direction);
         }
     }
   else if (arg.is_real_type ())
     {
       NDArray nda = arg.array_value ();
 
-      if (! error_state)
-        retval = find_nonzero_elem_idx (nda, nargout, n_to_find, direction);
+      retval = find_nonzero_elem_idx (nda, nargout, n_to_find, direction);
     }
   else if (arg.is_complex_type ())
     {
       ComplexNDArray cnda = arg.complex_array_value ();
 
-      if (! error_state)
-        retval = find_nonzero_elem_idx (cnda, nargout, n_to_find, direction);
+      retval = find_nonzero_elem_idx (cnda, nargout, n_to_find, direction);
     }
   else
     gripe_wrong_type_arg ("find", arg);