changeset 20956:850e3d2533d4

maint: Eliminate more useless statements after error(). * __ilu__.cc, display.cc, file-io.cc, graphics.cc, graphics.in.h, hex2num.cc, load-save.cc, ls-mat-ascii.cc, oct-errno.in.cc, pager.cc, sighandlers.cc, sub2ind.cc, symtab.h, syscalls.cc, toplev.h, txt-eng-ft.cc, __eigs__.cc, ov-bool-mat.cc, ov-classdef.h, ov-cx-mat.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-re-mat.cc, ov-str-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-usr-fcn.cc: maint: Eliminate more useless statements after error().
author Rik <rik@octave.org>
date Sun, 20 Dec 2015 13:26:17 -0800
parents 77f5591878bf
children 9db35d2042be
files libinterp/corefcn/__ilu__.cc libinterp/corefcn/display.cc libinterp/corefcn/file-io.cc libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h libinterp/corefcn/hex2num.cc libinterp/corefcn/load-save.cc libinterp/corefcn/ls-mat-ascii.cc libinterp/corefcn/oct-errno.in.cc libinterp/corefcn/pager.cc libinterp/corefcn/sighandlers.cc libinterp/corefcn/sub2ind.cc libinterp/corefcn/symtab.h libinterp/corefcn/syscalls.cc libinterp/corefcn/toplev.h libinterp/corefcn/txt-eng-ft.cc libinterp/dldfcn/__eigs__.cc libinterp/octave-value/ov-bool-mat.cc libinterp/octave-value/ov-classdef.h libinterp/octave-value/ov-cx-mat.cc libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-flt-cx-mat.cc libinterp/octave-value/ov-flt-re-mat.cc libinterp/octave-value/ov-re-mat.cc libinterp/octave-value/ov-str-mat.cc libinterp/octave-value/ov-struct.cc libinterp/octave-value/ov-typeinfo.cc libinterp/octave-value/ov-usr-fcn.cc
diffstat 28 files changed, 71 insertions(+), 243 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/__ilu__.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/__ilu__.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -109,16 +109,10 @@
         for (jj = uptr[k] + 1; jj < cidx[k+1]; jj++)
           data[jj] /=  data[uptr[k]];
       if (k != jrow)
-        {
-          error ("ilu: A has a zero on the diagonal");
-          break;
-        }
+        error ("ilu: A has a zero on the diagonal");
 
       if (data[j] == T(0))
-        {
-          error ("ilu: encountered a pivot equal to 0");
-          break;
-        }
+        error ("ilu: encountered a pivot equal to 0");
       for (i = j1; i <= j2; i++)
         iw[ridx[i]] = -1;
     }
@@ -351,10 +345,7 @@
 
       // Check if the pivot is zero
       if (data_u[total_len_u] == zero)
-        {
-          error ("ilu: encountered a pivot equal to 0");
-          break;
-        }
+        error ("ilu: encountered a pivot equal to 0");
 
       // Scale the elements in L by the pivot
       for (i = total_len_l ; i < (total_len_l + w_len_l); i++)
@@ -366,10 +357,7 @@
       // Check if there are too many elements to be indexed with
       // octave_idx_type type due to fill-in during the process.
       if (total_len_l < 0 || total_len_u < 0)
-        {
-          error ("ilu: integer overflow.  Too many fill-in elements in L or U");
-          break;
-        }
+        error ("ilu: integer overflow.  Too many fill-in elements in L or U");
       cidx_u[k+1] = cidx_u[k] - cidx_u[0] + w_len_u;
       cidx_l[k+1] = cidx_l[k] - cidx_l[0] + w_len_l;
 
@@ -776,10 +764,7 @@
               iw_u.insert (k);
             }
           else
-            {
-              error ("ilu: encountered a pivot equal to 0");
-              break;
-            }
+            error ("ilu: encountered a pivot equal to 0");
         }
 
       // Scale the elements on the L part for IKJ version (milu = [col|off])
@@ -839,10 +824,7 @@
       // Check if there are too many elements to be indexed with
       // octave_idx_type type due to fill-in during the process.
       if (total_len_l < 0 || total_len_u < 0)
-        {
-          error ("ilu: Integer overflow.  Too many fill-in elements in L or U");
-          break;
-        }
+        error ("ilu: Integer overflow.  Too many fill-in elements in L or U");
       if (opt == ROW)
         uptr[k] = total_len_u - 1;
       cidx_u[k+1] = cidx_u[k] - cidx_u[0] + w_len_u;
--- a/libinterp/corefcn/display.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/display.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -63,11 +63,7 @@
     }
 
   if (! instance)
-    {
-      error ("unable to create display_info object!");
-
-      retval = false;
-    }
+    error ("unable to create display_info object!");
 
   return retval;
 }
--- a/libinterp/corefcn/file-io.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/file-io.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -1881,10 +1881,7 @@
         {
           tmp = x % obase;
           if (tmp > ibase - 1)
-            {
-              error ("umask: invalid digit");
-              break;
-            }
+            error ("umask: invalid digit");
           retval += mult * tmp;
           mult *= ibase;
         }
--- a/libinterp/corefcn/graphics.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/graphics.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -99,10 +99,8 @@
   size_t num_matches = matches.size ();
 
   if (num_matches == 0)
-    {
-      error ("%s: unknown %s property %s",
-             who.c_str (), what.c_str (), pname.c_str ());
-    }
+    error ("%s: unknown %s property %s",
+           who.c_str (), what.c_str (), pname.c_str ());
   else if (num_matches > 1)
     {
       string_vector sv (matches);
@@ -2216,10 +2214,8 @@
                       const Cell& values, octave_idx_type row)
 {
   if (pnames.numel () != values.columns ())
-    {
-      error ("set: number of names must match number of value columns (%d != %d)",
-             pnames.numel (), values.columns ());
-    }
+    error ("set: number of names must match number of value columns (%d != %d)",
+           pnames.numel (), values.columns ());
 
   octave_idx_type k = pnames.columns ();
 
@@ -10816,13 +10812,11 @@
               if (val.compare ("expose"))
                 do_events = false;
               else
-                {
-                  error ("drawnow: invalid argument, 'expose' is only valid option");
-
-                  gh_manager::unlock ();
-
-                  return ovl ();
-                }
+              {
+                gh_manager::unlock ();
+
+                error ("drawnow: invalid argument, 'expose' is only valid option");
+              }
             }
 
           if (do_events)
@@ -10878,15 +10872,14 @@
 
                   file_stat fs (dirname);
 
-                  if (! (fs && fs.is_dir ()))
+                  if (! fs || ! fs.is_dir ())
                     {
+                      gh_manager::unlock ();
+
                       error ("drawnow: nonexistent directory '%s'",
                              dirname.c_str ());
-
-                      gh_manager::unlock ();
-
-                      return ovl ();
                     }
+
                 }
             }
 
--- a/libinterp/corefcn/graphics.in.h	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/graphics.in.h	Sun Dec 20 13:26:17 2015 -0800
@@ -854,10 +854,7 @@
     bool retval = true;
 
     if (! contains (val, match))
-      {
-        error ("invalid value = %s", val.c_str ());
-        retval = false;
-      }
+      error ("invalid value = %s", val.c_str ());
 
     return retval;
   }
@@ -2339,11 +2336,7 @@
       create_instance ();
 
     if (! instance)
-      {
-        error ("unable to create gh_manager!");
-
-        retval = false;
-      }
+      error ("unable to create gh_manager!");
 
     return retval;
   }
@@ -2726,9 +2719,7 @@
     if (valid_object ())
       return get_properties ().get (all);
     else
-      {
-        error ("base_graphics_object::get: invalid graphics object");
-      }
+      error ("base_graphics_object::get: invalid graphics object");
   }
 
   virtual octave_value get (const caseless_str& pname) const
@@ -2736,9 +2727,7 @@
     if (valid_object ())
       return get_properties ().get (pname);
     else
-      {
-        error ("base_graphics_object::get: invalid graphics object");
-      }
+      error ("base_graphics_object::get: invalid graphics object");
   }
 
   virtual octave_value get_default (const caseless_str&) const;
@@ -2783,9 +2772,7 @@
     if (valid_object ())
       return get_properties ().get_parent ();
     else
-      {
-        error ("base_graphics_object::get_parent: invalid graphics object");
-      }
+      error ("base_graphics_object::get_parent: invalid graphics object");
   }
 
   graphics_handle get_handle (void) const
@@ -2793,9 +2780,7 @@
     if (valid_object ())
       return get_properties ().get___myhandle__ ();
     else
-      {
-        error ("base_graphics_object::get_handle: invalid graphics object");
-      }
+      error ("base_graphics_object::get_handle: invalid graphics object");
   }
 
   virtual void remove_child (const graphics_handle& h)
@@ -2870,9 +2855,7 @@
     if (valid_object ())
       return get_properties ().get_toolkit ();
     else
-      {
-        error ("base_graphics_object::get_toolkit: invalid graphics object");
-      }
+      error ("base_graphics_object::get_toolkit: invalid graphics object");
   }
 
   virtual void add_property_listener (const std::string& nm,
@@ -5904,11 +5887,7 @@
       create_instance ();
 
     if (! instance)
-      {
-        error ("unable to create gh_manager!");
-
-        retval = false;
-      }
+      error ("unable to create gh_manager!");
 
     return retval;
   }
--- a/libinterp/corefcn/hex2num.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/hex2num.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -116,10 +116,7 @@
                     num.ival += static_cast<uint32_t> (ch - '0');
                 }
               else
-                {
-                  error ("hex2num: illegal character found in string S");
-                  break;
-                }
+                error ("hex2num: illegal character found in string S");
             }
 
           if (nc < nchars)
--- a/libinterp/corefcn/load-save.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/load-save.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -863,10 +863,9 @@
             }
         }
       else
-        {
-          error ("load: unable to determine file format of '%s'",
-                 orig_fname.c_str ());
-        }
+        error ("load: unable to determine file format of '%s'",
+               orig_fname.c_str ());
+
     }
 
   return retval;
--- a/libinterp/corefcn/ls-mat-ascii.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/ls-mat-ascii.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -317,13 +317,8 @@
                             break;
                         }
                       else
-                        {
-                          error ("load: failed to read matrix from file '%s'",
-                                 filename.c_str ());
-
-                          return retval;
-                        }
-
+                        error ("load: failed to read matrix from file '%s'",
+                               filename.c_str ());
                     }
                 }
             }
--- a/libinterp/corefcn/oct-errno.in.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/oct-errno.in.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -302,11 +302,7 @@
     }
 
   if (! instance)
-    {
-      error ("unable to create errno object!");
-
-      retval = false;
-    }
+    error ("unable to create errno object!");
 
   return retval;
 }
--- a/libinterp/corefcn/pager.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/pager.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -380,11 +380,7 @@
     }
 
   if (! instance)
-    {
-      error ("unable to create pager_stream object!");
-
-      retval = false;
-    }
+    error ("unable to create pager_stream object!");
 
   return retval;
 }
@@ -445,11 +441,7 @@
     }
 
   if (! instance)
-    {
-      error ("unable to create diary_stream object!");
-
-      retval = false;
-    }
+    error ("unable to create diary_stream object!");
 
   return retval;
 }
--- a/libinterp/corefcn/sighandlers.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/sighandlers.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -198,11 +198,7 @@
       }
 
     if (! instance)
-      {
-        error ("unable to create w32_interrupt_manager");
-
-        retval = false;
-      }
+      error ("unable to create w32_interrupt_manager");
 
     return retval;
   }
@@ -928,11 +924,7 @@
     }
 
   if (! instance)
-    {
-      error ("unable to create child list object!");
-
-      retval = false;
-    }
+    error ("unable to create child list object!");
 
   return retval;
 }
--- a/libinterp/corefcn/sub2ind.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/sub2ind.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -53,10 +53,7 @@
           if (ii == dimsv(i) && ii >= 0)
             dv(i) = ii;
           else
-            {
-              error ("%s: dimension vector DIMS must contain integers", name);
-              break;
-            }
+            error ("%s: dimension vector DIMS must contain integers", name);
         }
     }
 
--- a/libinterp/corefcn/symtab.h	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/symtab.h	Sun Dec 20 13:26:17 2015 -0800
@@ -93,11 +93,7 @@
         create_instance ();
 
       if (! instance)
-        {
-          error ("unable to create scope_id_cache object!");
-
-          retval = false;
-        }
+        error ("unable to create scope_id_cache object!");
 
       return retval;
     }
--- a/libinterp/corefcn/syscalls.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/syscalls.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -648,10 +648,7 @@
         {
           tmp = x % obase;
           if (tmp > ibase - 1)
-            {
-              error ("mkfifo: invalid digit");
-              break;
-            }
+            error ("mkfifo: invalid digit");
           retval += mult * tmp;
           mult *= ibase;
         }
--- a/libinterp/corefcn/toplev.h	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/toplev.h	Sun Dec 20 13:26:17 2015 -0800
@@ -135,11 +135,7 @@
       create_instance ();
 
     if (! instance)
-      {
-        error ("unable to create call stack object!");
-
-        retval = false;
-      }
+      error ("unable to create call stack object!");
 
     return retval;
   }
--- a/libinterp/corefcn/txt-eng-ft.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/corefcn/txt-eng-ft.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -89,11 +89,7 @@
       }
 
     if (! instance)
-      {
-        error ("unable to create ft_manager!");
-
-        retval = false;
-      }
+      error ("unable to create ft_manager!");
 
     return retval;
   }
--- a/libinterp/dldfcn/__eigs__.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/dldfcn/__eigs__.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -192,12 +192,7 @@
   call_depth++;
 
   if (call_depth > 1)
-    {
-      error ("eigs: invalid recursive call");
-      if (fcn_name.length ())
-        clear_function (fcn_name);
-      return retval;
-    }
+    error ("eigs: invalid recursive call");
 
   if (args(0).is_function_handle () || args(0).is_inline_function ()
       || args(0).is_string ())
--- a/libinterp/octave-value/ov-bool-mat.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-bool-mat.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -296,19 +296,13 @@
                 panic_impossible ();
             }
           else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
+            error ("load: failed to extract number of rows and columns");
         }
       else
         panic_impossible ();
     }
   else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
+    error ("load: failed to extract number of rows and columns");
 
   return success;
 }
--- a/libinterp/octave-value/ov-classdef.h	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-classdef.h	Sun Dec 20 13:26:17 2015 -0800
@@ -1615,11 +1615,7 @@
       create_instance ();
 
     if (! instance)
-      {
-        error ("unable to create cdef_manager!");
-
-        retval = false;
-      }
+      error ("unable to create cdef_manager!");
 
     return retval;
   }
--- a/libinterp/octave-value/ov-cx-mat.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-cx-mat.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -420,19 +420,13 @@
                 panic_impossible ();
             }
           else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
+            error ("load: failed to extract number of rows and columns");
         }
       else
         panic_impossible ();
     }
   else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
+    error ("load: failed to extract number of rows and columns");
 
   return success;
 }
--- a/libinterp/octave-value/ov-fcn-handle.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -453,10 +453,7 @@
                     = read_text_data (is, std::string (), dummy, t2, i);
 
                   if (! is)
-                    {
-                      error ("load: failed to load anonymous function handle");
-                      break;
-                    }
+                    error ("load: failed to load anonymous function handle");
 
                   symbol_table::assign (name, t2, local_scope, 0);
                 }
@@ -638,10 +635,7 @@
                                   dummy, t2, doc);
 
               if (! is)
-                {
-                  error ("load: failed to load anonymous function handle");
-                  break;
-                }
+                error ("load: failed to load anonymous function handle");
 
               symbol_table::assign (name, t2, local_scope);
             }
--- a/libinterp/octave-value/ov-flt-cx-mat.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-flt-cx-mat.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -394,19 +394,13 @@
                 panic_impossible ();
             }
           else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
+            error ("load: failed to extract number of rows and columns");
         }
       else
         panic_impossible ();
     }
   else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
+    error ("load: failed to extract number of rows and columns");
 
   return success;
 }
--- a/libinterp/octave-value/ov-flt-re-mat.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-flt-re-mat.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -421,19 +421,13 @@
                 panic_impossible ();
             }
           else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
+            error ("load: failed to extract number of rows and columns");
         }
       else
         panic_impossible ();
     }
   else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
+    error ("load: failed to extract number of rows and columns");
 
   return success;
 }
--- a/libinterp/octave-value/ov-re-mat.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-re-mat.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -523,19 +523,13 @@
                 panic_impossible ();
             }
           else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
+            error ("load: failed to extract number of rows and columns");
         }
       else
         panic_impossible ();
     }
   else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
+    error ("load: failed to extract number of rows and columns");
 
   return success;
 }
--- a/libinterp/octave-value/ov-str-mat.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-str-mat.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -377,10 +377,7 @@
                     }
                 }
               else
-                {
-                  error ("load: failed to read dimensions");
-                  success = false;
-                }
+                error ("load: failed to read dimensions");
             }
           else
             error ("load: failed to extract matrix size");
@@ -407,11 +404,7 @@
                       char *ptmp = tmp.fortran_vec ();
 
                       if (len > 0 && ! is.read (ptmp, len))
-                        {
-                          error ("load: failed to load string constant");
-                          success = false;
-                          break;
-                        }
+                        error ("load: failed to load string constant");
                       else
                         {
                           if (len > max_len)
@@ -424,11 +417,8 @@
                         }
                     }
                   else
-                    {
-                      error ("load: failed to extract string length for element %d",
-                             i+1);
-                      success = false;
-                    }
+                    error ("load: failed to extract string length for element %d",
+                           i+1);
                 }
 
               matrix = chm;
@@ -451,9 +441,7 @@
               char *ptmp = tmp.fortran_vec ();
 
               if (len > 0 && ! is.read (ptmp, len))
-                {
-                  error ("load: failed to load string constant");
-                }
+                error ("load: failed to load string constant");
               else
                 {
                   if (is)
@@ -467,10 +455,7 @@
         panic_impossible ();
     }
   else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
+    error ("load: failed to extract number of rows and columns");
 
   return success;
 }
--- a/libinterp/octave-value/ov-struct.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-struct.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -763,10 +763,7 @@
         panic_impossible ();
     }
   else
-    {
-      error ("load: failed to extract number of elements in structure");
-      success = false;
-    }
+    error ("load: failed to extract number of elements in structure");
 
   return success;
 }
@@ -1405,10 +1402,7 @@
         panic_impossible ();
     }
   else
-    {
-      error ("load: failed to extract number of elements in structure");
-      success = false;
-    }
+    error ("load: failed to extract number of elements in structure");
 
   return success;
 }
--- a/libinterp/octave-value/ov-typeinfo.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-typeinfo.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -51,11 +51,7 @@
     }
 
   if (! instance)
-    {
-      error ("unable to create value type info object!");
-
-      retval = false;
-    }
+    error ("unable to create value type info object!");
 
   return retval;
 }
--- a/libinterp/octave-value/ov-usr-fcn.cc	Sun Dec 20 10:15:02 2015 -0800
+++ b/libinterp/octave-value/ov-usr-fcn.cc	Sun Dec 20 13:26:17 2015 -0800
@@ -531,11 +531,9 @@
       if (ret_list)
         ret_list->define_from_arg_vector (ret_args);
       else
-        {
-          error ("%s: invalid classdef constructor, no output argument defined",
-                 dispatch_class ().c_str ());
-          return retval;
-        }
+        error ("%s: invalid classdef constructor, no output argument defined",
+               dispatch_class ().c_str ());
+
     }
 
   // Force parameter list to be undefined when this function exits.