diff libinterp/corefcn/ls-oct-text.cc @ 20962:3aa293be0e8d

maint: Invert simple conditionals in if/else/error paradigm. Invert conditional in if statement and place error next to if. Delete else, and decrease code indent by 4. * cellfun.cc, data.cc, debug.cc, dirfns.cc, dynamic-ld.cc, file-io.cc, gl2ps-renderer.cc, graphics.cc, graphics.in.h, hex2num.cc, load-save.cc, ls-mat-ascii.cc, ls-oct-text.cc, oct-hist.cc, oct-lvalue.cc, oct-map.cc, toplev.cc, __init_fltk__.cc, ov-base-int.cc, ov-bool-mat.cc, ov-cell.cc, ov-class.cc, ov-classdef.cc, ov-cx-mat.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-oncleanup.cc, ov-re-mat.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.cc, ov.cc, pt-arg-list.cc, pt-assign.cc, pt-colon.cc, pt-eval.cc, pt-exp.cc: Invert conditional in if statement and place error next to if. Delete else, and decrease code indent by 4.
author Rik <rik@octave.org>
date Tue, 22 Dec 2015 10:29:22 -0800
parents 48b2ad5ee801
children c11cea70b638
line wrap: on
line diff
--- a/libinterp/corefcn/ls-oct-text.cc	Tue Dec 22 07:43:44 2015 -0500
+++ b/libinterp/corefcn/ls-oct-text.cc	Tue Dec 22 10:29:22 2015 -0800
@@ -355,49 +355,47 @@
   octave_idx_type nr = tc.rows ();
   octave_idx_type nc = tc.columns ();
 
-  if (tc.is_real_matrix ())
-    {
-      os << "# 3-D data...\n"
-         << "# type: matrix\n"
-         << "# total rows: " << nr << "\n"
-         << "# total columns: " << nc << "\n";
+  if (! tc.is_real_matrix ())
+    error ("for now, I can only save real matrices in 3-D format");
 
-      long old_precision = os.precision ();
-      os.precision (6);
+  os << "# 3-D data...\n"
+     << "# type: matrix\n"
+     << "# total rows: " << nr << "\n"
+     << "# total columns: " << nc << "\n";
 
-      if (parametric)
-        {
-          octave_idx_type extras = nc % 3;
-          if (extras)
-            warning ("ignoring last %d columns", extras);
-
-          Matrix tmp = tc.matrix_value ();
-          nr = tmp.rows ();
+  long old_precision = os.precision ();
+  os.precision (6);
 
-          for (octave_idx_type i = 0; i < nc-extras; i += 3)
-            {
-              os << tmp.extract (0, i, nr-1, i+2);
-              if (i+3 < nc-extras)
-                os << "\n";
-            }
-        }
-      else
+  if (parametric)
+    {
+      octave_idx_type extras = nc % 3;
+      if (extras)
+        warning ("ignoring last %d columns", extras);
+
+      Matrix tmp = tc.matrix_value ();
+      nr = tmp.rows ();
+
+      for (octave_idx_type i = 0; i < nc-extras; i += 3)
         {
-          Matrix tmp = tc.matrix_value ();
-          nr = tmp.rows ();
-
-          for (octave_idx_type i = 0; i < nc; i++)
-            {
-              os << tmp.extract (0, i, nr-1, i);
-              if (i+1 < nc)
-                os << "\n";
-            }
+          os << tmp.extract (0, i, nr-1, i+2);
+          if (i+3 < nc-extras)
+            os << "\n";
         }
-
-      os.precision (old_precision);
     }
   else
-    error ("for now, I can only save real matrices in 3-D format");
+    {
+      Matrix tmp = tc.matrix_value ();
+      nr = tmp.rows ();
+
+      for (octave_idx_type i = 0; i < nc; i++)
+        {
+          os << tmp.extract (0, i, nr-1, i);
+          if (i+1 < nc)
+            os << "\n";
+        }
+    }
+
+  os.precision (old_precision);
 
   return (os && ! fail);
 }