This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Remove some NATIVE_TO_NEED calls
authorKarl Williamson <public@khwilliamson.com>
Wed, 20 Feb 2013 15:12:15 +0000 (08:12 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 29 Aug 2013 15:55:53 +0000 (09:55 -0600)
I believe NATIVE_TO_NEED is defective, and will remove it in a future
commit.  But, just in case I'm wrong, I'm doing it in small steps so
bisects will show the culprit.  This removes the calls to it where the
parameter is clearly invariant under UTF-8 and UTF-EBCDIC, and so the
result can't be other than just the parameter.

toke.c

diff --git a/toke.c b/toke.c
index 45e3fd9..9549183 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3163,11 +3163,11 @@ S_scan_const(pTHX_ char *start)
                    if (isLOWER_A(min)) {
                        for (i = min; i <= max; i++)
                            if (isLOWER_A(i))
-                               *d++ = NATIVE_TO_NEED(has_utf8,i);
+                               *d++ = i;
                    } else {
                        for (i = min; i <= max; i++)
                            if (isUPPER_A(i))
-                               *d++ = NATIVE_TO_NEED(has_utf8,i);
+                               *d++ = i;
                    }
                }
                else
@@ -3342,7 +3342,7 @@ S_scan_const(pTHX_ char *start)
                        || s[1] != '{'
                        || regcurly(s + 1, FALSE)))
            {
-               *d++ = NATIVE_TO_NEED(has_utf8,'\\');
+               *d++ = '\\';
                goto default_action;
            }
 
@@ -3736,25 +3736,25 @@ S_scan_const(pTHX_ char *start)
 
            /* printf-style backslashes, formfeeds, newlines, etc */
            case 'b':
-               *d++ = NATIVE_TO_NEED(has_utf8,'\b');
+               *d++ = '\b';
                break;
            case 'n':
-               *d++ = NATIVE_TO_NEED(has_utf8,'\n');
+               *d++ = '\n';
                break;
            case 'r':
-               *d++ = NATIVE_TO_NEED(has_utf8,'\r');
+               *d++ = '\r';
                break;
            case 'f':
-               *d++ = NATIVE_TO_NEED(has_utf8,'\f');
+               *d++ = '\f';
                break;
            case 't':
-               *d++ = NATIVE_TO_NEED(has_utf8,'\t');
+               *d++ = '\t';
                break;
            case 'e':
-               *d++ = ASCII_TO_NEED(has_utf8,'\033');
+               *d++ = ASCII_TO_NATIVE('\033');
                break;
            case 'a':
-               *d++ = NATIVE_TO_NEED(has_utf8,'\a');
+               *d++ = '\a';
                break;
            } /* end switch */