diff libinterp/octave-value/ov-base.cc @ 20879:5357423bca0a

Code Sprint 2015: remove return/break/goto after error
author Andreas Weber <andy.weber.aw@gmail.com>
date Sat, 12 Dec 2015 20:54:01 +0100
parents 1142cf6abc0d
children 48b2ad5ee801
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base.cc	Sat Dec 12 11:21:58 2015 -0800
+++ b/libinterp/octave-value/ov-base.cc	Sat Dec 12 20:54:01 2015 +0100
@@ -128,7 +128,6 @@
 {
   std::string nm = type_name ();
   error ("squeeze: invalid operation for %s type", nm.c_str ());
-  return octave_value ();
 }
 
 octave_value
@@ -160,7 +159,6 @@
 {
   std::string nm = type_name ();
   error ("can't perform indexing operations for %s type", nm.c_str ());
-  return octave_value ();
 }
 
 octave_value_list
@@ -169,7 +167,6 @@
 {
   std::string nm = type_name ();
   error ("can't perform indexing operations for %s type", nm.c_str ());
-  return octave_value ();
 }
 
 octave_value
@@ -196,7 +193,6 @@
 {
   std::string nm = type_name ();
   error ("can't perform indexing operations for %s type", nm.c_str ());
-  return octave_value ();
 }
 
 octave_value_list
@@ -204,7 +200,6 @@
 {
   std::string nm = type_name ();
   error ("can't perform indexing operations for %s type", nm.c_str ());
-  return octave_value ();
 }
 
 octave_value_list
@@ -946,16 +941,12 @@
 octave_scalar_map
 octave_base_value::scalar_map_value (void) const
 {
-  octave_scalar_map retval;
-
   octave_map tmp = map_value ();
 
-  if (tmp.numel () == 1)
-    retval = tmp.checkelem (0);
-  else
+  if (tmp.numel () != 1)
     error ("invalid conversion of multi-dimensional struct to scalar struct");
 
-  return retval;
+  return octave_scalar_map (tmp.checkelem (0));
 }
 
 string_vector
@@ -1286,7 +1277,6 @@
 octave_base_value::map (unary_mapper_t umap) const
 {
   error ("%s: not defined for %s", get_umap_name (umap), type_name ().c_str ());
-  return octave_value ();
 }
 
 void
@@ -1342,10 +1332,7 @@
   octave_value retval;
 
   if (idx.front ().empty ())
-    {
-      error ("missing index in indexed assignment");
-      return retval;
-    }
+    error ("missing index in indexed assignment");
 
   int t_lhs = type_id ();
   int t_rhs = rhs.type_id ();
@@ -1621,16 +1608,10 @@
                     if (val.is_string ())
                       subs_field(i) = val;
                     else
-                      {
-                        error ("string argument required for '.' index");
-                        return retval;
-                      }
+                      error ("string argument required for '.' index");
                   }
                 else
-                  {
-                    error ("only single argument permitted for '.' index");
-                    return retval;
-                  }
+                  error ("only single argument permitted for '.' index");
               }
               break;