This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Summon constman! S_checkcomma now has all 3 arguments const char.
authorNicholas Clark <nick@ccl4.org>
Fri, 10 Mar 2006 11:31:14 +0000 (11:31 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 10 Mar 2006 11:31:14 +0000 (11:31 +0000)
p4raw-id: //depot/perl@27459

embed.fnc
proto.h
toke.c

index cd67051..8a13284 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1401,7 +1401,8 @@ s |char*  |scan_word      |NN char *s|NN char *dest|STRLEN destlen \
                                |int allow_package|NN STRLEN *slp
 sR     |char*  |skipspace      |NN char *s
 sR     |char*  |swallow_bom    |NN U8 *s
-s      |void   |checkcomma     |NN char *s|NN const char *name|NN const char *what
+s      |void   |checkcomma     |NN const char *s|NN const char *name \
+                               |NN const char *what
 s      |bool   |feature_is_enabled|NN char* name|STRLEN namelen
 s      |void   |force_ident    |NN const char *s|int kind
 s      |void   |incline        |NN char *s
diff --git a/proto.h b/proto.h
index 5208f6f..16e549b 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3839,7 +3839,7 @@ STATIC char*      S_swallow_bom(pTHX_ U8 *s)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1);
 
-STATIC void    S_checkcomma(pTHX_ char *s, const char *name, const char *what)
+STATIC void    S_checkcomma(pTHX_ const char *s, const char *name, const char *what)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
                        __attribute__nonnull__(pTHX_3);
diff --git a/toke.c b/toke.c
index 11fcb65..3d01366 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -10167,7 +10167,7 @@ unknown:
 }
 
 STATIC void
-S_checkcomma(pTHX_ register char *s, const char *name, const char *what)
+S_checkcomma(pTHX_ const char *s, const char *name, const char *what)
 {
     dVAR;
     const char *w;
@@ -10201,17 +10201,12 @@ S_checkcomma(pTHX_ register char *s, const char *name, const char *what)
        while (s < PL_bufend && isSPACE(*s))
            s++;
        if (*s == ',') {
-           I32 kw;
-           CV *cv;
-           *s = '\0'; /* XXX If we didn't do this, we could const a lot of toke.c */
-           kw = keyword(w, s - w);
-           *s = ',';
-           if (kw)
+           GV* gv;
+           if (keyword(w, s - w))
                return;
-           *s = '\0';
-           cv = get_cv(w, FALSE);
-           *s = ',';
-           if (cv)
+
+           gv = gv_fetchpvn_flags(w, s - w, 0, SVt_PVCV);
+           if (gv && GvCVu(gv))
                return;
            Perl_croak(aTHX_ "No comma allowed after %s", what);
        }