diff libinterp/corefcn/filter.cc @ 20892:c07bee629973

2015 Code Sprint: use ovl ().
author Rik <rik@octave.org>
date Mon, 14 Dec 2015 11:28:48 -0800
parents 1142cf6abc0d
children 03e4ddd49396
line wrap: on
line diff
--- a/libinterp/corefcn/filter.cc	Mon Dec 14 14:01:36 2015 +0000
+++ b/libinterp/corefcn/filter.cc	Mon Dec 14 11:28:48 2015 -0800
@@ -371,8 +371,6 @@
 @seealso{filter2, fftfilt, freqz}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-
   int nargin = args.length ();
 
   if (nargin < 3 || nargin > 5)
@@ -402,6 +400,8 @@
         dim = 0;
     }
 
+  octave_value_list retval (nargout > 1 ? 2 : 1);
+
   bool isfloat = (args(0).is_single_type ()
                   || args(1).is_single_type ()
                   || args(2).is_single_type ()
@@ -444,10 +444,9 @@
 
           FloatComplexNDArray y (filter (b, a, x, si, dim));
 
+          retval(0) = y;
           if (nargout == 2)
             retval(1) = si;
-
-          retval(0) = y;
         }
       else
         {
@@ -482,10 +481,9 @@
 
           ComplexNDArray y (filter (b, a, x, si, dim));
 
+          retval(0) = y;
           if (nargout == 2)
             retval(1) = si;
-
-          retval(0) = y;
         }
     }
   else
@@ -523,10 +521,9 @@
 
           FloatNDArray y (filter (b, a, x, si, dim));
 
+          retval(0) = y;
           if (nargout == 2)
             retval(1) = si;
-
-          retval(0) = y;
         }
       else
         {
@@ -561,10 +558,9 @@
 
           NDArray y (filter (b, a, x, si, dim));
 
+          retval(0) = y;
           if (nargout == 2)
             retval(1) = si;
-
-          retval(0) = y;
         }
     }