changeset 21124:95f8c8cdbffe

maint: Eliminate 'bool success' variable where possible. * ov-base-diag.cc (load_ascii): Remove success var, return true. * ov-base-int.cc (load_ascii): Remove success var, return true. * ov-base-sparse.cc (load_ascii): Remove success var, return true. * ov-bool-mat.cc (load_ascii): Remove success var, return true. * ov-cx-mat.cc (load_ascii): Remove success var, return true. * ov-fcn-handle.cc (set_fcn): Remove success var, return true. * ov-flt-cx-mat.cc (load_ascii): Remove success var, return true. * ov-flt-re-mat.cc (load_ascii): Remove success var, return true. * ov-perm.cc (load_ascii): Remove success var, return true. * ov-re-mat.cc (load_ascii): Remove success var, return true. * ov-str-mat.cc (load_ascii): Remove success var, return true. * ov-struct.cc (load_ascii): Remove success var, return true.
author Rik <rik@octave.org>
date Wed, 20 Jan 2016 21:54:36 -0800
parents 71408ab5071e
children 8f76684324b5
files libinterp/octave-value/ov-base-diag.cc libinterp/octave-value/ov-base-int.cc libinterp/octave-value/ov-base-sparse.cc libinterp/octave-value/ov-bool-mat.cc 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-perm.cc libinterp/octave-value/ov-re-mat.cc libinterp/octave-value/ov-str-mat.cc libinterp/octave-value/ov-struct.cc
diffstat 12 files changed, 12 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base-diag.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-base-diag.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -490,7 +490,6 @@
 {
   octave_idx_type r = 0;
   octave_idx_type c = 0;
-  bool success = true;
 
   if (! extract_keyword (is, "rows", r, true)
       || ! extract_keyword (is, "columns", c, true))
@@ -513,7 +512,7 @@
   // Invalidate cache. Probably not necessary, but safe.
   dense_cache = octave_value ();
 
-  return success;
+  return true;
 }
 
 template <class DMT, class MT>
--- a/libinterp/octave-value/ov-base-int.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-base-int.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -205,7 +205,6 @@
 octave_base_int_matrix<T>::load_ascii (std::istream& is)
 {
   int mdims = 0;
-  bool success = true;
 
   if (! extract_keyword (is, "ndims", mdims, true))
     error ("load: failed to extract number of dimensions");
@@ -228,7 +227,7 @@
 
   this->matrix = tmp;
 
-  return success;
+  return true;
 }
 
 template <class T>
--- a/libinterp/octave-value/ov-base-sparse.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-base-sparse.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -444,7 +444,6 @@
   octave_idx_type nz = 0;
   octave_idx_type nr = 0;
   octave_idx_type nc = 0;
-  bool success = true;
 
   if (! extract_keyword (is, "nnz", nz, true)
       || ! extract_keyword (is, "rows", nr, true)
@@ -460,7 +459,7 @@
 
   matrix = tmp;
 
-  return success;
+  return true;
 }
 
 
--- a/libinterp/octave-value/ov-bool-mat.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-bool-mat.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -207,8 +207,6 @@
 bool
 octave_bool_matrix::load_ascii (std::istream& is)
 {
-  bool success = true;
-
   string_vector keywords (2);
 
   keywords[0] = "ndims";
@@ -284,7 +282,7 @@
   else
     panic_impossible ();
 
-  return success;
+  return true;
 }
 
 bool
--- a/libinterp/octave-value/ov-cx-mat.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-cx-mat.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -343,8 +343,6 @@
 bool
 octave_complex_matrix::load_ascii (std::istream& is)
 {
-  bool success = true;
-
   string_vector keywords(2);
 
   keywords[0] = "ndims";
@@ -406,7 +404,7 @@
   else
     panic_impossible ();
 
-  return success;
+  return true;
 }
 
 bool
--- a/libinterp/octave-value/ov-fcn-handle.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -251,8 +251,6 @@
 octave_fcn_handle::set_fcn (const std::string &octaveroot,
                             const std::string& fpath)
 {
-  bool success = true;
-
   if (octaveroot.length () != 0
       && fpath.length () >= octaveroot.length ()
       && fpath.substr (0, octaveroot.length ()) == octaveroot
@@ -331,7 +329,7 @@
         }
     }
 
-  return success;
+  return true;
 }
 
 bool
--- a/libinterp/octave-value/ov-flt-cx-mat.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-flt-cx-mat.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -317,8 +317,6 @@
 bool
 octave_float_complex_matrix::load_ascii (std::istream& is)
 {
-  bool success = true;
-
   string_vector keywords(2);
 
   keywords[0] = "ndims";
@@ -380,7 +378,7 @@
   else
     panic_impossible ();
 
-  return success;
+  return true;
 }
 
 bool
--- a/libinterp/octave-value/ov-flt-re-mat.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-flt-re-mat.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -339,8 +339,6 @@
 bool
 octave_float_matrix::load_ascii (std::istream& is)
 {
-  bool success = true;
-
   string_vector keywords(2);
 
   keywords[0] = "ndims";
@@ -402,7 +400,7 @@
   else
     panic_impossible ();
 
-  return success;
+  return true;
 }
 
 bool
--- a/libinterp/octave-value/ov-perm.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-perm.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -275,7 +275,6 @@
 octave_perm_matrix::load_ascii (std::istream& is)
 {
   octave_idx_type n;
-  bool success = true;
   char orient;
 
   if (! extract_keyword (is, "size", n, true)
@@ -295,7 +294,7 @@
   // Invalidate cache. Probably not necessary, but safe.
   dense_cache = octave_value ();
 
-  return success;
+  return true;
 }
 
 bool
--- a/libinterp/octave-value/ov-re-mat.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-re-mat.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -441,8 +441,6 @@
 bool
 octave_matrix::load_ascii (std::istream& is)
 {
-  bool success = true;
-
   string_vector keywords(2);
 
   keywords[0] = "ndims";
@@ -504,7 +502,7 @@
   else
     panic_impossible ();
 
-  return success;
+  return true;
 }
 
 bool
--- a/libinterp/octave-value/ov-str-mat.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-str-mat.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -322,8 +322,6 @@
 bool
 octave_char_matrix_str::load_ascii (std::istream& is)
 {
-  bool success = true;
-
   string_vector keywords(3);
 
   keywords[0] = "ndims";
@@ -432,7 +430,7 @@
   else
     panic_impossible ();
 
-  return success;
+  return true;
 }
 
 bool
--- a/libinterp/octave-value/ov-struct.cc	Wed Jan 20 21:30:55 2016 -0800
+++ b/libinterp/octave-value/ov-struct.cc	Wed Jan 20 21:54:36 2016 -0800
@@ -1356,7 +1356,6 @@
 bool
 octave_scalar_struct::load_ascii (std::istream& is)
 {
-  bool success = true;
   octave_idx_type len = 0;
 
   if (! extract_keyword (is, "length", len) || len < 0)
@@ -1391,7 +1390,7 @@
   else
     panic_impossible ();
 
-  return success;
+  return true;
 }
 
 bool