diff libinterp/octave-value/ov-class.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 dfcb9d74b253
children 8f76684324b5
line wrap: on
line diff
--- a/libinterp/octave-value/ov-class.cc	Wed Jan 20 15:45:58 2016 -0800
+++ b/libinterp/octave-value/ov-class.cc	Wed Jan 20 16:08:30 2016 -0800
@@ -481,15 +481,13 @@
 {
   octave_value retval;
 
-  if (val.numel () == 1)
-    {
-      retval = val(0);
+  if (val.numel () != 1)
+    err_invalid_index_for_assignment ();
 
-      if (type.length () > 0 && type[0] == '.' && ! retval.is_map ())
-        retval = octave_map ();
-    }
-  else
-    err_invalid_index_for_assignment ();
+  retval = val(0);
+
+  if (type.length () > 0 && type[0] == '.' && ! retval.is_map ())
+    retval = octave_map ();
 
   return retval;
 }
@@ -683,23 +681,21 @@
               }
 
             // FIXME: better code reuse?
-            if (tmpc.numel () == 1)
-              {
-                octave_value& tmp = tmpc(0);
+            if (tmpc.numel () != 1)
+              err_indexed_cs_list ();
+
+            octave_value& tmp = tmpc(0);
 
-                if (! tmp.is_defined () || tmp.is_zero_by_zero ())
-                  {
-                    tmp = octave_value::empty_conv (next_type, rhs);
-                    tmp.make_unique (); // probably a no-op.
-                  }
-                else
-                  // optimization: ignore copy still stored inside our map.
-                  tmp.make_unique (1);
-
-                t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
+            if (! tmp.is_defined () || tmp.is_zero_by_zero ())
+              {
+                tmp = octave_value::empty_conv (next_type, rhs);
+                tmp.make_unique (); // probably a no-op.
               }
             else
-              err_indexed_cs_list ();
+              // optimization: ignore copy still stored inside our map.
+              tmp.make_unique (1);
+
+            t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
           }
           break;