changeset 20821:b169da150702

Eliminate unnecessary uses of nargin. * regexp.cc: Eliminate unnecessary uses of nargin.
author Rik <rik@octave.org>
date Mon, 07 Dec 2015 22:29:12 -0800
parents eed8ec05f1c8
children 40fc94a24a97
files libinterp/corefcn/regexp.cc
diffstat 1 files changed, 11 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/regexp.cc	Mon Dec 07 14:29:39 2015 -0500
+++ b/libinterp/corefcn/regexp.cc	Mon Dec 07 22:29:12 2015 -0800
@@ -853,12 +853,10 @@
 @seealso{regexpi, strfind, regexprep}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
+  if (args.length () < 2)
+    print_usage ();
 
-  int nargin = args.length ();
-
-  if (nargin < 2)
-    print_usage ();
+  octave_value_list retval;
 
   if (args(0).is_cell () || args(1).is_cell ())
     retval = octcellregexp (args, (nargout > 0 ? nargout : 1), "regexp");
@@ -1149,12 +1147,10 @@
 @seealso{regexp}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
+  if (args.length () < 2)
+    print_usage ();
 
-  int nargin = args.length ();
-
-  if (nargin < 2)
-    print_usage ();
+  octave_value_list retval;
 
   if (args(0).is_cell () || args(1).is_cell ())
     retval = octcellregexp (args, (nargout > 0 ? nargout : 1), "regexpi", true);
@@ -1384,17 +1380,14 @@
 @seealso{regexp, regexpi, strrep}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
-  int nargin = args.length ();
+  if (args.length () < 3)
+    print_usage ();
 
-  if (nargin < 3)
-    print_usage ();
+  octave_value_list retval;
 
   if (args(0).is_cell () || args(1).is_cell () || args(2).is_cell ())
     {
-      Cell str;
-      Cell pat;
-      Cell rep;
+      Cell str, pat, rep;
       dim_vector dv0;
       dim_vector dv1 (1, 1);
 
@@ -1447,7 +1440,7 @@
         }
 
       retval = args(0).is_cell () ? octave_value (ret)
-        : octave_value (ret(0));
+                                  : octave_value (ret(0));
     }
   else
     retval = octregexprep (args, "regexprep");