diff libinterp/corefcn/colloc.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 f1b2a2dbc0e1
children 48b2ad5ee801
line wrap: on
line diff
--- a/libinterp/corefcn/colloc.cc	Wed Dec 16 17:09:44 2015 -0500
+++ b/libinterp/corefcn/colloc.cc	Wed Dec 16 15:00:31 2015 -0800
@@ -43,8 +43,6 @@
 @cite{Solution of Differential Equation Models by Polynomial Approximation}.\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   int nargin = args.length ();
 
   if (nargin < 1 || nargin > 3)
@@ -54,7 +52,6 @@
     error ("colloc: N must be a scalar");
 
   double tmp = args(0).double_value ();
-
   if (xisnan (tmp))
     error ("colloc: N cannot be NaN");
 
@@ -70,16 +67,11 @@
     {
       std::string s = args(i).xstring_value ("colloc: optional arguments must be strings");
 
-      if ((s.length () == 1 && (s[0] == 'R' || s[0] == 'r'))
-          || s == "right")
-        {
-          right = 1;
-        }
+      if ((s.length () == 1 && (s[0] == 'R' || s[0] == 'r')) || s == "right")
+        right = 1;
       else if ((s.length () == 1 && (s[0] == 'L' || s[0] == 'l'))
                || s == "left")
-        {
-          left = 1;
-        }
+        left = 1;
       else
         error ("colloc: string argument must be \"left\" or \"right\"");
     }
@@ -95,7 +87,6 @@
   Matrix B = wts.second ();
   ColumnVector q = wts.quad_weights ();
 
-  retval = ovl (r, A, B, q);
+  return ovl (r, A, B, q);
+}
 
-  return retval;
-}