diff libinterp/octave-value/ovl.cc @ 20996:20bd3d4fabad

Clean up instances of make_argv(). * error.cc (Fwarning, Flasterr, Flastwarn): Use '[]' to access element of vector, rather than '()'. * help.cc (F__which__): Call make_argv without an argument rather than with "". * input.cc: (Fecho): Call make_argv without an argument rather than with "". * load-save.cc: Remove useless comments. Re-indent lines. Join lines unnecessarily split. * ovl.cc (make_argv): Invert if/else/error.
author Rik <rik@octave.org>
date Sun, 27 Dec 2015 12:25:03 -0800
parents fc9cca99b2de
children fcac5dbbf9ed
line wrap: on
line diff
--- a/libinterp/octave-value/ovl.cc	Mon Dec 28 16:44:10 2015 +0100
+++ b/libinterp/octave-value/ovl.cc	Sun Dec 27 12:25:03 2015 -0800
@@ -215,49 +215,47 @@
 {
   string_vector argv;
 
-  if (all_strings_p ())
+  if (! all_strings_p ())
+    error ("%s: all arguments must be strings", fcn_name.c_str ());
+
+  octave_idx_type len = length ();
+
+  octave_idx_type total_nr = 0;
+
+  for (octave_idx_type i = 0; i < len; i++)
     {
-      octave_idx_type len = length ();
+      // An empty std::string ("") has zero columns and zero rows
+      // (a change that was made for Matlab contemptibility.
 
-      octave_idx_type total_nr = 0;
+      octave_idx_type n = elem (i).rows ();
+
+      total_nr += n ? n : 1;
+    }
 
-      for (octave_idx_type i = 0; i < len; i++)
-        {
-          // An empty std::string ("") has zero columns and zero rows (a
-          // change that was made for Matlab contemptibility.
+  octave_idx_type k = 0;
+  if (! fcn_name.empty ())
+    {
+      argv.resize (total_nr+1);
+      argv[0] = fcn_name;
+      k = 1;
+    }
+  else
+    argv.resize (total_nr);
 
-          octave_idx_type n = elem(i).rows ();
+  for (octave_idx_type i = 0; i < len; i++)
+    {
+      octave_idx_type nr = elem (i).rows ();
 
-          total_nr += n ? n : 1;
-        }
-
-      octave_idx_type k = 0;
-      if (! fcn_name.empty ())
+      if (nr < 2)
+        argv[k++] = elem (i).string_value ();
+      else
         {
-          argv.resize (total_nr+1);
-          argv[0] = fcn_name;
-          k = 1;
-        }
-      else
-        argv.resize (total_nr);
+          string_vector tmp = elem (i).string_vector_value ();
 
-      for (octave_idx_type i = 0; i < len; i++)
-        {
-          octave_idx_type nr = elem(i).rows ();
-
-          if (nr < 2)
-            argv[k++] = elem(i).string_value ();
-          else
-            {
-              string_vector tmp = elem(i).string_vector_value ();
-
-              for (octave_idx_type j = 0; j < nr; j++)
-                argv[k++] = tmp[j];
-            }
+          for (octave_idx_type j = 0; j < nr; j++)
+            argv[k++] = tmp[j];
         }
     }
-  else
-    error ("%s: all arguments must be strings", fcn_name.c_str ());
 
   return argv;
 }