Change core calls of isALNUM() to isWORDCHAR()
authorKarl Williamson <public@khwilliamson.com>
Sun, 30 Dec 2012 03:51:00 +0000 (20:51 -0700)
committerKarl Williamson <public@khwilliamson.com>
Mon, 31 Dec 2012 18:11:58 +0000 (11:11 -0700)
The latter is more clearly named to indicate it includes the underscore.

13 files changed:
dist/Data-Dumper/Changes
dist/Data-Dumper/Dumper.pm
dist/Data-Dumper/Dumper.xs
doio.c
dquote_static.c
op.c
perl.c
perlio.c
regcomp.c
regexec.c
taint.c
toke.c
util.h

index 5ec8d25..cc66a36 100644 (file)
@@ -6,6 +6,10 @@ Changes - public release history for Data::Dumper
 
 =over 8
 
+=item 2.140 (Dec 30 2012)
+
+Change call of isALNUM to equivalent but more clearly named isWORDCHAR
+
 =item 2.139 (Dec 12 2012)
 
 Supply an explicit dynamic_config => 0 in META
index 4999576..4fefb72 100644 (file)
@@ -10,7 +10,7 @@
 package Data::Dumper;
 
 BEGIN {
-    $VERSION = '2.139'; # Don't forget to set version and release
+    $VERSION = '2.140'; # Don't forget to set version and release
 }                         # date in POD below!
 
 #$| = 1;
@@ -1359,7 +1359,7 @@ modify it under the same terms as Perl itself.
 
 =head1 VERSION
 
-Version 2.139  (December 12 2012)
+Version 2.140  (December 30 2012)
 
 =head1 SEE ALSO
 
index 27c611f..d7204e1 100644 (file)
@@ -103,7 +103,7 @@ TOP:
     }
     if (isIDFIRST(*s)) {
        while (++s<send)
-           if (!isALNUM(*s)) {
+           if (!isWORDCHAR(*s)) {
                if (*s == ':')
                    goto TOP;
                else
diff --git a/doio.c b/doio.c
index 1cc0e41..795d138 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -1499,7 +1499,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
        goto doshell;
 
     s = cmd;
-    while (isALNUM(*s))
+    while (isWORDCHAR(*s))
        s++;    /* catch VAR=val gizmo */
     if (*s == '=')
        goto doshell;
index 868cd06..5cc890b 100644 (file)
@@ -68,7 +68,7 @@ S_grok_bslash_c(pTHX_ const char source, const bool utf8, const bool output_warn
        else {
            U8 clearer[3];
            U8 i = 0;
-           if (! isALNUM(result)) {
+           if (! isWORDCHAR(result)) {
                clearer[i++] = '\\';
            }
            clearer[i++] = result;
diff --git a/op.c b/op.c
index 60184b6..51f40cd 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3121,10 +3121,10 @@ Perl_localize(pTHX_ OP *o, I32 lex)
 
            while (1) {
                if (*s && strchr("@$%*", *s) && *++s
-                      && (isALNUM(*s) || UTF8_IS_CONTINUED(*s))) {
+                      && (isWORDCHAR(*s) || UTF8_IS_CONTINUED(*s))) {
                    s++;
                    sigil = TRUE;
-                   while (*s && (isALNUM(*s) || UTF8_IS_CONTINUED(*s)))
+                   while (*s && (isWORDCHAR(*s) || UTF8_IS_CONTINUED(*s)))
                        s++;
                    while (*s && (strchr(", \t\n", *s)))
                        s++;
diff --git a/perl.c b/perl.c
index 5751704..0cfb73c 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3035,7 +3035,7 @@ Perl_get_debug_opts(pTHX_ const char **s, bool givehelp)
        /* if adding extra options, remember to update DEBUG_MASK */
        static const char debopts[] = "psltocPmfrxuUHXDSTRJvCAqMB";
 
-       for (; isALNUM(**s); (*s)++) {
+       for (; isWORDCHAR(**s); (*s)++) {
            const char * const d = strchr(debopts,**s);
            if (d)
                i |= 1 << (d - debopts);
@@ -3046,7 +3046,7 @@ Perl_get_debug_opts(pTHX_ const char **s, bool givehelp)
     }
     else if (isDIGIT(**s)) {
        i = atoi(*s);
-       for (; isALNUM(**s); (*s)++) ;
+       for (; isWORDCHAR(**s); (*s)++) ;
     }
     else if (givehelp) {
       const char *const *p = usage_msgd;
@@ -3140,7 +3140,7 @@ Perl_moreswitches(pTHX_ const char *s)
        s++;
 
         /* -dt indicates to the debugger that threads will be used */
-       if (*s == 't' && !isALNUM(s[1])) {
+       if (*s == 't' && !isWORDCHAR(s[1])) {
            ++s;
            my_setenv("PERL5DB_THREADED", "1");
        }
@@ -3163,7 +3163,7 @@ Perl_moreswitches(pTHX_ const char *s)
            end = s + strlen(s);
 
            /* We now allow -d:Module=Foo,Bar and -d:-Module */
-           while(isALNUM(*s) || *s==':') ++s;
+           while(isWORDCHAR(*s) || *s==':') ++s;
            if (*s != '=')
                sv_catpvn(sv, start, end - start);
            else {
@@ -3191,7 +3191,7 @@ Perl_moreswitches(pTHX_ const char *s)
        if (ckWARN_d(WARN_DEBUGGING))
            Perl_warner(aTHX_ packWARN(WARN_DEBUGGING),
                   "Recompile perl with -DDEBUGGING to use -D switch (did you mean -d ?)\n");
-       for (s++; isALNUM(*s); s++) ;
+       for (s++; isWORDCHAR(*s); s++) ;
 #endif
        return s;
     }  
@@ -3284,7 +3284,7 @@ Perl_moreswitches(pTHX_ const char *s)
            sv = newSVpvn(use,4);
            start = s;
            /* We allow -M'Module qw(Foo Bar)'  */
-           while(isALNUM(*s) || *s==':') {
+           while(isWORDCHAR(*s) || *s==':') {
                if( *s++ == ':' ) {
                    if( *s == ':' ) 
                        s++;
index a388ba7..3e6e0a6 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -1005,7 +1005,7 @@ PerlIO_parse_layers(pTHX_ PerlIO_list_t *av, const char *names)
                }
                do {
                    e++;
-               } while (isALNUM(*e));
+               } while (isWORDCHAR(*e));
                llen = e - s;
                if (*e == '(') {
                    int nesting = 1;
index f87698d..29a0469 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6799,11 +6799,11 @@ S_reg_scan_name(pTHX_ RExC_state_t *pRExC_state, U32 flags)
        if (UTF)
            do {
                RExC_parse += UTF8SKIP(RExC_parse);
-           } while (isALNUM_utf8((U8*)RExC_parse));
+           } while (isWORDCHAR_utf8((U8*)RExC_parse));
        else
            do {
                RExC_parse++;
-           } while (isALNUM(*RExC_parse));
+           } while (isWORDCHAR(*RExC_parse));
     } else {
        RExC_parse++; /* so the <- from the vFAIL is after the offending character */
         vFAIL("Group name must start with a non-digit word character");
@@ -11352,7 +11352,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
        const char *s = RExC_parse;
        const char  c = *s++;
 
-       while (isALNUM(*s))
+       while (isWORDCHAR(*s))
            s++;
        if (*s && c == *s && s[1] == ']') {
            SAVEFREESV(RExC_rx_sv);
@@ -11627,7 +11627,7 @@ parseit:
                }
            default:
                /* Allow \_ to not give an error */
-               if (!SIZE_ONLY && isALNUM(value) && value != '_') {
+               if (!SIZE_ONLY && isWORDCHAR(value) && value != '_') {
                    SAVEFREESV(RExC_rx_sv);
                    SAVEFREESV(listsv);
                    ckWARN2reg(RExC_parse,
index 4e2008a..1860909 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1619,19 +1619,19 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
     }
     case BOUNDL:
         RXp_MATCH_TAINTED_on(prog);
-        FBC_BOUND(isALNUM_LC,
-                  isALNUM_LC_uvchr(UNI_TO_NATIVE(tmp)),
-                  isALNUM_LC_utf8((U8*)s));
+        FBC_BOUND(isWORDCHAR_LC,
+                  isWORDCHAR_LC_uvchr(UNI_TO_NATIVE(tmp)),
+                  isWORDCHAR_LC_utf8((U8*)s));
         break;
     case NBOUNDL:
         RXp_MATCH_TAINTED_on(prog);
-        FBC_NBOUND(isALNUM_LC,
-                   isALNUM_LC_uvchr(UNI_TO_NATIVE(tmp)),
-                   isALNUM_LC_utf8((U8*)s));
+        FBC_NBOUND(isWORDCHAR_LC,
+                   isWORDCHAR_LC_uvchr(UNI_TO_NATIVE(tmp)),
+                   isWORDCHAR_LC_utf8((U8*)s));
         break;
     case BOUND:
         FBC_BOUND(isWORDCHAR,
-                  isALNUM_uni(tmp),
+                  isWORDCHAR_uni(tmp),
                   cBOOL(swash_fetch(PL_utf8_swash_ptrs[_CC_WORDCHAR], (U8*)s, utf8_target)));
         break;
     case BOUNDA:
@@ -1641,7 +1641,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
         break;
     case NBOUND:
         FBC_NBOUND(isWORDCHAR,
-                   isALNUM_uni(tmp),
+                   isWORDCHAR_uni(tmp),
                    cBOOL(swash_fetch(PL_utf8_swash_ptrs[_CC_WORDCHAR], (U8*)s, utf8_target)));
         break;
     case NBOUNDA:
@@ -1651,12 +1651,12 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
         break;
     case BOUNDU:
         FBC_BOUND(isWORDCHAR_L1,
-                  isALNUM_uni(tmp),
+                  isWORDCHAR_uni(tmp),
                   cBOOL(swash_fetch(PL_utf8_swash_ptrs[_CC_WORDCHAR], (U8*)s, utf8_target)));
         break;
     case NBOUNDU:
         FBC_NBOUND(isWORDCHAR_L1,
-                   isALNUM_uni(tmp),
+                   isWORDCHAR_uni(tmp),
                    cBOOL(swash_fetch(PL_utf8_swash_ptrs[_CC_WORDCHAR], (U8*)s, utf8_target)));
         break;
     case LNBREAK:
@@ -4211,7 +4211,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
                    ln = utf8n_to_uvchr(r, UTF8SKIP(r), 0, uniflags);
                }
                if (FLAGS(scan) != REGEX_LOCALE_CHARSET) {
-                   ln = isALNUM_uni(ln);
+                   ln = isWORDCHAR_uni(ln);
                     if (NEXTCHR_IS_EOS)
                         n = 0;
                     else {
@@ -4221,8 +4221,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
                     }
                }
                else {
-                   ln = isALNUM_LC_uvchr(UNI_TO_NATIVE(ln));
-                   n = NEXTCHR_IS_EOS ? 0 : isALNUM_LC_utf8((U8*)locinput);
+                   ln = isWORDCHAR_LC_uvchr(UNI_TO_NATIVE(ln));
+                   n = NEXTCHR_IS_EOS ? 0 : isWORDCHAR_LC_utf8((U8*)locinput);
                }
            }
            else {
@@ -4246,12 +4246,12 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
                        n = NEXTCHR_IS_EOS ? 0 : isWORDCHAR_L1(nextchr);
                        break;
                    case REGEX_LOCALE_CHARSET:
-                       ln = isALNUM_LC(ln);
-                       n = NEXTCHR_IS_EOS ? 0 : isALNUM_LC(nextchr);
+                       ln = isWORDCHAR_LC(ln);
+                       n = NEXTCHR_IS_EOS ? 0 : isWORDCHAR_LC(nextchr);
                        break;
                    case REGEX_DEPENDS_CHARSET:
-                       ln = isALNUM(ln);
-                       n = NEXTCHR_IS_EOS ? 0 : isALNUM(nextchr);
+                       ln = isWORDCHAR(ln);
+                       n = NEXTCHR_IS_EOS ? 0 : isWORDCHAR(nextchr);
                        break;
                    case REGEX_ASCII_RESTRICTED_CHARSET:
                    case REGEX_ASCII_MORE_RESTRICTED_CHARSET:
diff --git a/taint.c b/taint.c
index 9a296db..4ebba5b 100644 (file)
--- a/taint.c
+++ b/taint.c
@@ -158,9 +158,9 @@ Perl_taint_env(pTHX)
        const char *t = SvPV_const(*svp, len);
        const char * const e = t + len;
        TAINT_set(was_tainted);
-       if (t < e && isALNUM(*t))
+       if (t < e && isWORDCHAR(*t))
            t++;
-       while (t < e && (isALNUM(*t) || strchr("-_.+", *t)))
+       while (t < e && (isWORDCHAR(*t) || strchr("-_.+", *t)))
            t++;
        if (t < e) {
            TAINT;
diff --git a/toke.c b/toke.c
index a0b50f7..01b3e7f 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3881,7 +3881,7 @@ S_intuit_more(pTHX_ char *s)
                    weight -= 5;        /* cope with negative subscript */
                break;
            default:
-               if (!isALNUM(last_un_char)
+               if (!isWORDCHAR(last_un_char)
                    && !(last_un_char == '$' || last_un_char == '@'
                         || last_un_char == '&')
                    && isALPHA(*s) && s[1] && isALPHA(s[1])) {
@@ -5485,7 +5485,7 @@ Perl_yylex(pTHX)
        }
        goto retry;
     case '-':
-       if (s[1] && isALPHA(s[1]) && !isALNUM(s[2])) {
+       if (s[1] && isALPHA(s[1]) && !isWORDCHAR(s[2])) {
            I32 ftst = 0;
            char tmp;
 
@@ -5990,9 +5990,9 @@ Perl_yylex(pTHX)
                }
                else if (*s == 'q') {
                    if (++t < PL_bufend
-                       && (!isALNUM(*t)
+                       && (!isWORDCHAR(*t)
                            || ((*t == 'q' || *t == 'x') && ++t < PL_bufend
-                               && !isALNUM(*t))))
+                               && !isWORDCHAR(*t))))
                    {
                        /* skip q//-like construct */
                        const char *tmps;
@@ -6273,8 +6273,8 @@ Perl_yylex(pTHX)
 
                    if (*t == '/' || *t == '?' ||
                        ((*t == 'm' || *t == 's' || *t == 'y')
-                        && !isALNUM(t[1])) ||
-                       (*t == 't' && t[1] == 'r' && !isALNUM(t[2])))
+                        && !isWORDCHAR(t[1])) ||
+                       (*t == 't' && t[1] == 'r' && !isWORDCHAR(t[2])))
                        Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
                                    "!=~ should be !~");
                }
@@ -9170,7 +9170,7 @@ S_scan_word(pTHX_ char *s, char *dest, STRLEN destlen, int allow_package, STRLEN
     for (;;) {
        if (d >= e)
            Perl_croak(aTHX_ ident_too_long);
-       if (isALNUM(*s)
+       if (isWORDCHAR(*s)
             || (!UTF && isALPHANUMERIC_L1(*s))) /* UTF handled below */
         {
            *d++ = *s++;
@@ -9184,7 +9184,7 @@ S_scan_word(pTHX_ char *s, char *dest, STRLEN destlen, int allow_package, STRLEN
            *d++ = *s++;
            *d++ = *s++;
        }
-       else if (UTF && UTF8_IS_START(*s) && isALNUM_utf8((U8*)s)) {
+       else if (UTF && UTF8_IS_START(*s) && isWORDCHAR_utf8((U8*)s)) {
            char *t = s + UTF8SKIP(s);
            size_t len;
            while (UTF8_IS_CONTINUED(*t) && _is_utf8_mark((U8*)t))
@@ -9228,7 +9228,7 @@ S_scan_ident(pTHX_ char *s, const char *send, char *dest, STRLEN destlen, I32 ck
        for (;;) {
            if (d >= e)
                Perl_croak(aTHX_ ident_too_long);
-           if (isALNUM(*s))    /* UTF handled below */
+           if (isWORDCHAR(*s)) /* UTF handled below */
                *d++ = *s++;
            else if (*s == '\'' && isIDFIRST_lazy_if(s+1,UTF)) {
                *d++ = ':';
@@ -9239,7 +9239,7 @@ S_scan_ident(pTHX_ char *s, const char *send, char *dest, STRLEN destlen, I32 ck
                *d++ = *s++;
                *d++ = *s++;
            }
-           else if (UTF && UTF8_IS_START(*s) && isALNUM_utf8((U8*)s)) {
+           else if (UTF && UTF8_IS_START(*s) && isWORDCHAR_utf8((U8*)s)) {
                char *t = s + UTF8SKIP(s);
                while (UTF8_IS_CONTINUED(*t) && _is_utf8_mark((U8*)t))
                    t += UTF8SKIP(t);
@@ -9312,7 +9312,7 @@ S_scan_ident(pTHX_ char *s, const char *send, char *dest, STRLEN destlen, I32 ck
                s = end;
            }
            else {
-               while ((isALNUM(*s) || *s == ':') && d < e)
+               while ((isWORDCHAR(*s) || *s == ':') && d < e)
                    *d++ = *s++;
                if (d >= e)
                    Perl_croak(aTHX_ ident_too_long);
@@ -9338,11 +9338,11 @@ S_scan_ident(pTHX_ char *s, const char *send, char *dest, STRLEN destlen, I32 ck
        }
        /* Handle extended ${^Foo} variables
         * 1999-02-27 mjd-perl-patch@plover.com */
-       else if (!isALNUM(*d) && !isPRINT(*d) /* isCTRL(d) */
-                && isALNUM(*s))
+       else if (!isWORDCHAR(*d) && !isPRINT(*d) /* isCTRL(d) */
+                && isWORDCHAR(*s))
        {
            d++;
-           while (isALNUM(*s) && d < e) {
+           while (isWORDCHAR(*s) && d < e) {
                *d++ = *s++;
            }
            if (d >= e)
diff --git a/util.h b/util.h
index 5f11289..ed133c4 100644 (file)
--- a/util.h
+++ b/util.h
@@ -13,7 +13,7 @@
        (*(f) == '/'                                                    \
         || (strchr(f,':')                                              \
             || ((*(f) == '[' || *(f) == '<')                           \
-                && (isALNUM((f)[1]) || strchr("$-_]>",(f)[1])))))
+                && (isWORDCHAR((f)[1]) || strchr("$-_]>",(f)[1])))))
 
 #else          /* !VMS */
 #  if defined(WIN32) || defined(__CYGWIN__)