integrate mainline to get tr.t
[p5sagit/p5-mst-13.2.git] / regcomp.c
index 02b65d6..ca0fd09 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -38,7 +38,7 @@
 /* *These* symbols are masked to allow static link. */
 #  define Perl_pregfree my_regfree
 #  define Perl_regnext my_regnext
-#  define save_re_context my_save_re_context
+#  define Perl_save_re_context my_save_re_context
 #endif 
 
 /*SUPPRESS 112*/
@@ -493,7 +493,7 @@ study_chunk(regnode **scanp, I32 *deltap, regnode *last, scan_data_t *data, U32
                    scan = next;
                if (ckWARN(WARN_UNSAFE) && (minnext + deltanext == 0) 
                    && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))
-                   && maxcount <= 10000) /* Complement check for big count */
+                   && maxcount <= REG_INFTY/3) /* Complement check for big count */
                    warner(WARN_UNSAFE, "Strange *+?{} on zero-length expression");
                min += minnext * mincount;
                is_inf_internal |= (maxcount == REG_INFTY 
@@ -792,7 +792,7 @@ pregcomp(char *exp, char *xend, PMOP *pm)
     if (exp == NULL)
        FAIL("NULL regexp argument");
 
-    if (PL_curcop == &compiling ? (PL_hints & HINT_UTF8) : IN_UTF8)
+    if (PL_curcop == &PL_compiling ? (PL_hints & HINT_UTF8) : IN_UTF8)
        PL_reg_flags |= RF_utf8;
     else
        PL_reg_flags = 0;
@@ -1160,8 +1160,9 @@ reg(I32 paren, I32 *flagp)
                    PL_regcomp_rx->data->data[n+2] = (void*)sop;
                    SvREFCNT_dec(sv);
                }
-               else {          /* First pass */
-                   if (PL_reginterp_cnt < ++PL_seen_evals && PL_curcop != &compiling)
+               else {                                          /* First pass */
+                   if (PL_reginterp_cnt < ++PL_seen_evals
+                       && PL_curcop != &PL_compiling)
                        /* No compiled RE interpolated, has runtime
                           components ===> unsafe.  */
                        FAIL("Eval-group not allowed at runtime, use re 'eval'");
@@ -1210,10 +1211,14 @@ reg(I32 paren, I32 *flagp)
                    else
                        regtail(br, reganode(LONGJMP, 0));
                    c = *nextchar();
+                   if (flags&HASWIDTH)
+                       *flagp |= HASWIDTH;
                    if (c == '|') {
                        lastbr = reganode(IFTHEN, 0); /* Fake one for optimizer. */
                        regbranch(&flags, 1);
                        regtail(ret, lastbr);
+                       if (flags&HASWIDTH)
+                           *flagp |= HASWIDTH;
                        c = *nextchar();
                    }
                    else
@@ -1582,7 +1587,7 @@ regpiece(I32 *flagp)
        goto do_curly;
     }
   nest_check:
-    if (ckWARN(WARN_UNSAFE) && !SIZE_ONLY && !(flags&HASWIDTH) && max > 10000) {
+    if (ckWARN(WARN_UNSAFE) && !SIZE_ONLY && !(flags&HASWIDTH) && max > REG_INFTY/3) {
        warner(WARN_UNSAFE, "%.*s matches null string many times",
            PL_regcomp_parse - origparse, origparse);
     }
@@ -2266,7 +2271,9 @@ regclass(void)
        if (!SIZE_ONLY) {
 #ifndef ASCIIish
            if ((isLOWER(lastvalue) && isLOWER(value)) ||
-               (isUPPER(lastvalue) && isUPPER(value))) {
+               (isUPPER(lastvalue) && isUPPER(value)))
+           {
+               I32 i;
                if (isLOWER(lastvalue)) {
                    for (i = lastvalue; i <= value; i++)
                        if (isLOWER(i))