No need to pass bad_proto to scan_named_proto
authorPeter Martini <PeterCMartini@GMail.com>
Tue, 9 Oct 2012 06:43:45 +0000 (02:43 -0400)
committerPeter Martini <PeterCMartini@GMail.com>
Wed, 17 Oct 2012 20:36:14 +0000 (16:36 -0400)
embed.fnc
embed.h
proto.h
toke.c

index 31ab0c3..a94715b 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -2147,7 +2147,7 @@ s |U8*    |add_utf16_textfilter|NN U8 *const s|bool reversed
 #endif
 s      |void   |checkcomma     |NN const char *s|NN const char *name \
                                |NN const char *what
-s      |bool   |scan_named_proto       |NN SV *sv|NN bool *bad
+s      |bool   |scan_named_proto       |NN SV *sv
 s      |void   |force_ident    |NN const char *s|int kind
 s      |void   |force_ident_maybe_lex|char pit
 s      |void   |incline        |NN const char *s
diff --git a/embed.h b/embed.h
index 7f91e44..09773ce 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define scan_heredoc(a)                S_scan_heredoc(aTHX_ a)
 #define scan_ident(a,b,c,d,e)  S_scan_ident(aTHX_ a,b,c,d,e)
 #define scan_inputsymbol(a)    S_scan_inputsymbol(aTHX_ a)
-#define scan_named_proto(a,b)  S_scan_named_proto(aTHX_ a,b)
+#define scan_named_proto(a)    S_scan_named_proto(aTHX_ a)
 #define scan_pat(a,b)          S_scan_pat(aTHX_ a,b)
 #define scan_str(a,b,c,d)      S_scan_str(aTHX_ a,b,c,d)
 #define scan_subst(a)          S_scan_subst(aTHX_ a)
diff --git a/proto.h b/proto.h
index fda5aaa..e41fbda 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -7145,11 +7145,10 @@ STATIC char*    S_scan_inputsymbol(pTHX_ char *start)
 #define PERL_ARGS_ASSERT_SCAN_INPUTSYMBOL      \
        assert(start)
 
-STATIC bool    S_scan_named_proto(pTHX_ SV *sv, bool *bad)
-                       __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_2);
+STATIC bool    S_scan_named_proto(pTHX_ SV *sv)
+                       __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_SCAN_NAMED_PROTO      \
-       assert(sv); assert(bad)
+       assert(sv)
 
 STATIC char*   S_scan_pat(pTHX_ char *start, I32 type)
                        __attribute__warn_unused_result__
diff --git a/toke.c b/toke.c
index a93ab66..b13de7f 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -8899,8 +8899,7 @@ Perl_scan_proto (pTHX_ SV *sv, bool allowextended)
     SvCUR_set(sv, tmp);
 
     if (named_proto) {
-       use_for_cvproto = scan_named_proto(sv,
-                                          &bad_proto);
+       use_for_cvproto = bad_proto = scan_named_proto(sv);
        seen_underscore = FALSE;
     }
 
@@ -8936,17 +8935,17 @@ Perl_scan_proto (pTHX_ SV *sv, bool allowextended)
 */
 
 bool
-S_scan_named_proto (pTHX_ SV *sv, bool * bad)
+S_scan_named_proto (pTHX_ SV *sv)
 {
     STRLEN protolen, len;
     char *proto;
     char token[sizeof PL_tokenbuf];
     AV *protolist;
     int argcount, index;
+    bool bad = false;
 
     PERL_ARGS_ASSERT_SCAN_NAMED_PROTO;
 
-    *bad = false;
     protolist = newAV();
     proto = SvPV(sv, protolen);
     while (*proto) {
@@ -8961,23 +8960,23 @@ S_scan_named_proto (pTHX_ SV *sv, bool * bad)
                if (*proto == ',')
                    proto++;
                else if (*proto != '\0') {
-                   *bad = true;
+                   bad = true;
                    break;
                }
            }
            else {
-               *bad = true;
+               bad = true;
                break;
            }
        }
        else {
-           *bad = true;
+           bad = true;
            break;
        }
     }
 
     /* Undo what's been done if this is invalid, and return early */
-    if (*bad) {
+    if (bad) {
        sv_free(MUTABLE_SV(protolist));
        return true;
     }