Change #12607 introduced a bug, seems like some MAGICAL SVs
[p5sagit/p5-mst-13.2.git] / regcomp.c
index 96bafd3..a223533 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -2879,9 +2879,10 @@ tryagain:
                  /* a lovely hack--pretend we saw [\pX] instead */
                    RExC_end = strchr(RExC_parse, '}');
                    if (!RExC_end) {
+                       U8 c = (U8)*RExC_parse;
                        RExC_parse += 2;
                        RExC_end = oldregxend;
-                       vFAIL2("Missing right brace on \\%c{}", UCHARAT(RExC_parse - 2));
+                       vFAIL2("Missing right brace on \\%c{}", c);
                    }
                    RExC_end++;
                }
@@ -2961,6 +2962,8 @@ tryagain:
            register char *p;
            char *oldp, *s;
            STRLEN numlen;
+           STRLEN ulen;
+           U8 tmpbuf[UTF8_MAXLEN*2+1];
 
             parse_start = RExC_parse - 1;
 
@@ -3103,10 +3106,8 @@ tryagain:
                if (RExC_flags16 & PMf_EXTENDED)
                    p = regwhite(p, RExC_end);
                if (UTF && FOLD) {
-                   if (LOC)
-                       ender = toLOWER_LC_uvchr(ender);
-                   else
-                       ender = toLOWER_uni(ender);
+                   toLOWER_uni(ender, tmpbuf, &ulen);
+                   ender = utf8_to_uvchr(tmpbuf, 0);
                }
                if (ISMULT2(p)) { /* Back off on ?+*. */
                    if (len)
@@ -3421,13 +3422,14 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
            case 'p':
            case 'P':
                if (*RExC_parse == '{') {
+                   U8 c = (U8)value;
                    e = strchr(RExC_parse++, '}');
                     if (!e)
-                        vFAIL2("Missing right brace on \\%c{}", value);
+                        vFAIL2("Missing right brace on \\%c{}", c);
                    while (isSPACE(UCHARAT(RExC_parse)))
                        RExC_parse++;
                     if (e == RExC_parse)
-                        vFAIL2("Empty \\%c{}", value);
+                        vFAIL2("Empty \\%c{}", c);
                    n = e - RExC_parse;
                    while (isSPACE(UCHARAT(RExC_parse + n - 1)))
                        n--;