diff libinterp/corefcn/fft2.cc @ 20918:6f0bd96f93c0

maint: Use new C++ archetype in more files. Place input validation first in files. Move declaration of retval down in function to be closer to point of usage. Eliminate else clause after if () error. Use "return ovl()" where it makes sense. * __dispatch__.cc, __dsearchn__.cc, __ichol__.cc, __lin_interpn__.cc, balance.cc, betainc.cc, bitfcns.cc, bsxfun.cc, cellfun.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, dirfns.cc, dlmread.cc, dot.cc, eig.cc, error.cc, fft.cc, fft2.cc, fftn.cc, file-io.cc, ov-type-conv.h: Use new C++ archetype in more files.
author Rik <rik@octave.org>
date Wed, 16 Dec 2015 15:00:31 -0800
parents 1142cf6abc0d
children 48b2ad5ee801
line wrap: on
line diff
--- a/libinterp/corefcn/fft2.cc	Wed Dec 16 17:09:44 2015 -0500
+++ b/libinterp/corefcn/fft2.cc	Wed Dec 16 15:00:31 2015 -0800
@@ -44,13 +44,12 @@
 static octave_value
 do_fft2 (const octave_value_list &args, const char *fcn, int type)
 {
-  octave_value retval;
-
   int nargin = args.length ();
 
   if (nargin < 1 || nargin > 3)
     print_usage ();
 
+  octave_value retval;
   octave_value arg = args(0);
   dim_vector dims = arg.dims ();
   octave_idx_type n_rows = -1;
@@ -60,12 +59,10 @@
       double dval = args(1).double_value ();
       if (xisnan (dval))
         error ("%s: number of rows (N) cannot be NaN", fcn);
-      else
-        {
-          n_rows = NINTbig (dval);
-          if (n_rows < 0)
-            error ("%s: number of rows (N) must be greater than zero", fcn);
-        }
+
+      n_rows = NINTbig (dval);
+      if (n_rows < 0)
+        error ("%s: number of rows (N) must be greater than zero", fcn);
     }
 
   octave_idx_type n_cols = -1;
@@ -74,12 +71,10 @@
       double dval = args(2).double_value ();
       if (xisnan (dval))
         error ("%s: number of columns (M) cannot be NaN", fcn);
-      else
-        {
-          n_cols = NINTbig (dval);
-          if (n_cols < 0)
-            error ("%s: number of columns (M) must be greater than zero", fcn);
-        }
+
+      n_cols = NINTbig (dval);
+      if (n_cols < 0)
+        error ("%s: number of columns (M) must be greater than zero", fcn);
     }
 
   for (int i = 0; i < dims.length (); i++)