diff libinterp/corefcn/hess.cc @ 20909:03e4ddd49396

omit unnecessary nargout checks * paramdemo.cc, __ichol__.cc, __ilu__.cc, balance.cc, dassl.cc, eig.cc, ellipj.cc, filter.cc, givens.cc, hess.cc, lsode.cc, lu.cc, mgorth.cc, nproc.cc, pr-output.cc, quad.cc, quadcc.cc, sylvester.cc, urlwrite.cc, variables.cc, ccolamd.cc, colamd.cc, qr.cc: Don't call print_usage based on value of nargout. If nargout doesn't alter function behavior and returning extra values is inexpensive, simply return them instead of checking nargout.
author John W. Eaton <jwe@octave.org>
date Wed, 16 Dec 2015 11:41:11 -0500
parents f1b2a2dbc0e1
children b17fda023ca6
line wrap: on
line diff
--- a/libinterp/corefcn/hess.cc	Wed Dec 16 10:25:05 2015 +0100
+++ b/libinterp/corefcn/hess.cc	Wed Dec 16 11:41:11 2015 -0500
@@ -66,7 +66,7 @@
 {
   octave_value_list retval;
 
-  if (args.length () != 1 || nargout > 2)
+  if (args.length () != 1)
     print_usage ();
 
   octave_value arg = args(0);
@@ -98,10 +98,8 @@
           if (nargout <= 1)
             retval = ovl (result.hess_matrix ());
           else
-            {
-              retval = ovl (result.unitary_hess_matrix (),
-                            result.hess_matrix ());
-            }
+            retval = ovl (result.unitary_hess_matrix (),
+                          result.hess_matrix ());
         }
       else if (arg.is_complex_type ())
         {
@@ -112,10 +110,8 @@
           if (nargout <= 1)
             retval = ovl (result.hess_matrix ());
           else
-            {
-              retval = ovl (result.unitary_hess_matrix (),
-                            result.hess_matrix ());
-            }
+            retval = ovl (result.unitary_hess_matrix (),
+                          result.hess_matrix ());
         }
     }
   else
@@ -129,10 +125,8 @@
           if (nargout <= 1)
             retval = ovl (result.hess_matrix ());
           else
-            {
-              retval = ovl (result.unitary_hess_matrix (),
-                            result.hess_matrix ());
-            }
+            retval = ovl (result.unitary_hess_matrix (),
+                          result.hess_matrix ());
         }
       else if (arg.is_complex_type ())
         {
@@ -143,10 +137,8 @@
           if (nargout <= 1)
             retval = ovl (result.hess_matrix ());
           else
-            {
-              retval = ovl (result.unitary_hess_matrix (),
-                            result.hess_matrix ());
-            }
+            retval = ovl (result.unitary_hess_matrix (),
+                          result.hess_matrix ());
         }
       else
         {