Change 13672 by jhi@alpha on 2001/12/13 14:19:28

        Unadorned numbers evil.

Affected files ...

.... //depot/perl/pp.c#321 edit
.... //depot/perl/regcomp.c#256 edit
.... //depot/perl/regexec.c#213 edit
.... //depot/perl/utf8.c#126 edit
.... //depot/perl/utf8.h#45 edit

Differences ...

==== //depot/perl/pp.c#321 (text) ====
Index: perl/pp.c
--- perl/pp.c.~1~       Thu Dec 13 07:30:05 2001
+++ perl/pp.c   Thu Dec 13 07:30:05 2001
@@ -3210,7 +3210,7 @@
     STRLEN slen;
 
     if (DO_UTF8(sv)) {
-       U8 tmpbuf[UTF8_MAXLEN*2+1];
+       U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
        STRLEN ulen;
        STRLEN tculen;
 
@@ -3265,7 +3265,7 @@
 
     if (DO_UTF8(sv) && (s = (U8*)SvPV(sv, slen)) && slen && UTF8_IS_START(*s)) {
        STRLEN ulen;
-       U8 tmpbuf[UTF8_MAXLEN*2+1];
+       U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
        U8 *tend;
        UV uv;
 
@@ -3322,7 +3322,7 @@
        STRLEN ulen;
        register U8 *d;
        U8 *send;
-       U8 tmpbuf[UTF8_MAXLEN*2+1];
+       U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
 
        s = (U8*)SvPV(sv,len);
        if (!len) {
@@ -3389,7 +3389,7 @@
        STRLEN ulen;
        register U8 *d;
        U8 *send;
-       U8 tmpbuf[UTF8_MAXLEN*2+1];
+       U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
 
        s = (U8*)SvPV(sv,len);
        if (!len) {

==== //depot/perl/regcomp.c#256 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c.~1~  Thu Dec 13 07:30:05 2001
+++ perl/regcomp.c      Thu Dec 13 07:30:05 2001
@@ -2988,7 +2988,7 @@
            char *oldp, *s;
            STRLEN numlen;
            STRLEN ulen;
-           U8 tmpbuf[UTF8_MAXLEN*2+1];
+           U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
 
             parse_start = RExC_parse - 1;
 

==== //depot/perl/regexec.c#213 (text) ====
Index: perl/regexec.c
--- perl/regexec.c.~1~  Thu Dec 13 07:30:05 2001
+++ perl/regexec.c      Thu Dec 13 07:30:05 2001
@@ -932,8 +932,8 @@
            ln = STR_LEN(c);
            if (UTF) {
                STRLEN ulen1, ulen2;
-               U8 tmpbuf1[UTF8_MAXLEN*2+1];
-               U8 tmpbuf2[UTF8_MAXLEN*2+1];
+               U8 tmpbuf1[UTF8_MAXLEN_UCLC+1];
+               U8 tmpbuf2[UTF8_MAXLEN_UCLC+1];
 
                to_utf8_lower((U8*)m, tmpbuf1, &ulen1);
                to_utf8_upper((U8*)m, tmpbuf2, &ulen2);
@@ -2285,7 +2285,7 @@
                char *l = locinput;
                char *e;
                STRLEN ulen;
-               U8 tmpbuf[UTF8_MAXLEN*2+1];
+               U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
                e = s + ln;
                while (s < e) {
                    if (l >= PL_regeol)
@@ -2558,8 +2558,8 @@
                 */
                if (OP(scan) == REFF) {
                    STRLEN ulen1, ulen2;
-                   U8 tmpbuf1[UTF8_MAXLEN*2+1];
-                   U8 tmpbuf2[UTF8_MAXLEN*2+1];
+                   U8 tmpbuf1[UTF8_MAXLEN_UCLC+1];
+                   U8 tmpbuf2[UTF8_MAXLEN_UCLC+1];
                    while (s < e) {
                        if (l >= PL_regeol)
                            sayNO;
@@ -3364,8 +3364,8 @@
                    else { /* UTF */
                        if (OP(text_node) == EXACTF || OP(text_node) == REFF) {
                             STRLEN ulen1, ulen2;
-                            U8 tmpbuf1[UTF8_MAXLEN*2+1];
-                            U8 tmpbuf2[UTF8_MAXLEN*2+1];
+                            U8 tmpbuf1[UTF8_MAXLEN_UCLC+1];
+                            U8 tmpbuf2[UTF8_MAXLEN_UCLC+1];
 
                             to_utf8_lower((U8*)s, tmpbuf1, &ulen1);
                             to_utf8_upper((U8*)s, tmpbuf2, &ulen2);
@@ -4110,7 +4110,7 @@
                    match = TRUE;
                else if (flags & ANYOF_FOLD) {
                    STRLEN ulen;
-                   U8 tmpbuf[UTF8_MAXLEN*2+1];
+                   U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
 
                    toLOWER_utf8(p, tmpbuf, &ulen);
                    if (swash_fetch(sw, tmpbuf, do_utf8))

==== //depot/perl/utf8.c#126 (text) ====
Index: perl/utf8.c
--- perl/utf8.c.~1~     Thu Dec 13 07:30:05 2001
+++ perl/utf8.c Thu Dec 13 07:30:05 2001
@@ -903,7 +903,7 @@
 bool
 Perl_is_uni_xdigit(pTHX_ UV c)
 {
-    U8 tmpbuf[UTF8_MAXLEN*2+1];
+    U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
     uvchr_to_utf8(tmpbuf, (UV)c);
     return is_utf8_xdigit(tmpbuf);
 }
@@ -911,7 +911,7 @@
 UV
 Perl_to_uni_upper(pTHX_ UV c, U8* p, STRLEN *lenp)
 {
-    U8 tmpbuf[UTF8_MAXLEN*2+1];
+    U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
     uvchr_to_utf8(tmpbuf, (UV)c);
     return to_utf8_upper(tmpbuf, p, lenp);
 }
@@ -919,7 +919,7 @@
 UV
 Perl_to_uni_title(pTHX_ UV c, U8* p, STRLEN *lenp)
 {
-    U8 tmpbuf[UTF8_MAXLEN*2+1];
+    U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
     uvchr_to_utf8(tmpbuf, (UV)c);
     return to_utf8_title(tmpbuf, p, lenp);
 }
@@ -1596,8 +1596,8 @@
      STRLEN la, lb;
      UV ca, cb;
      STRLEN ulen1, ulen2;
-     U8 tmpbuf1[UTF8_MAXLEN*3+1];
-     U8 tmpbuf2[UTF8_MAXLEN*3+1];
+     U8 tmpbuf1[UTF8_MAXLEN_FOLD+1];
+     U8 tmpbuf2[UTF8_MAXLEN_FOLD+1];
      
      while (a < ae && b < be) {
          if (u1) {

==== //depot/perl/utf8.h#45 (text) ====
Index: perl/utf8.h
--- perl/utf8.h.~1~     Thu Dec 13 07:30:05 2001
+++ perl/utf8.h Thu Dec 13 07:30:05 2001
@@ -135,7 +135,12 @@
 #define isIDFIRST_lazy(p)      isIDFIRST_lazy_if(p,1)
 #define isALNUM_lazy(p)                isALNUM_lazy_if(p,1)
 
-#define UTF8_MAXLEN 13 /* how wide can a single UTF8 encoded character become */
+/* how wide can a single UTF8 encoded character become */
+#define UTF8_MAXLEN 13
+/* how wide a character can become when upper/lowercased */
+#define UTF8_MAXLEN_UCLC (UTF8_MAXLEN*2)
+/* how wide a character can become when casefolded */
+#define UTF8_MAXLEN_FOLD (UTF8_MAXLEN*3)
 
 #define IN_BYTES (PL_curcop->op_private & HINT_BYTES)
 #define DO_UTF8(sv) (SvUTF8(sv) && !IN_BYTES)
End of Patch.

Reply via email to