Integrate with Sarathy.
[p5sagit/p5-mst-13.2.git] / pp.c
diff --git a/pp.c b/pp.c
index e688848..a1b088a 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -2308,8 +2308,7 @@ PP(pp_ucfirst)
            s = (U8*)SvPV_force(sv, slen);
            Copy(tmpbuf, s, ulen, U8);
        }
-    }
-    else {
+    } else {
        if (!SvPADTMP(sv)) {
            dTARGET;
            sv_setsv(TARG, sv);
@@ -2365,8 +2364,7 @@ PP(pp_lcfirst)
            s = (U8*)SvPV_force(sv, slen);
            Copy(tmpbuf, s, ulen, U8);
        }
-    }
-    else {
+    } else {
        if (!SvPADTMP(sv)) {
            dTARGET;
            sv_setsv(TARG, sv);
@@ -2407,8 +2405,7 @@ PP(pp_uc)
        if (!len) {
            sv_setpvn(TARG, "", 0);
            SETs(TARG);
-       }
-       else {
+       } else {
            (void)SvUPGRADE(TARG, SVt_PV);
            SvGROW(TARG, (len * 2) + 1);
            (void)SvPOK_only(TARG);
@@ -2432,8 +2429,7 @@ PP(pp_uc)
            SvCUR_set(TARG, d - (U8*)SvPVX(TARG));
            SETs(TARG);
        }
-    }
-    else {
+    } else {
        if (!SvPADTMP(sv)) {
            dTARGET;
            sv_setsv(TARG, sv);
@@ -2478,8 +2474,7 @@ PP(pp_lc)
        if (!len) {
            sv_setpvn(TARG, "", 0);
            SETs(TARG);
-       }
-       else {
+       } else {
            (void)SvUPGRADE(TARG, SVt_PV);
            SvGROW(TARG, (len * 2) + 1);
            (void)SvPOK_only(TARG);
@@ -2503,8 +2498,7 @@ PP(pp_lc)
            SvCUR_set(TARG, d - (U8*)SvPVX(TARG));
            SETs(TARG);
        }
-    }
-    else {
+    } else {
        if (!SvPADTMP(sv)) {
            dTARGET;
            sv_setsv(TARG, sv);
@@ -3199,7 +3193,9 @@ PP(pp_reverse)
                        s += UTF8SKIP(s);
                        down = (char*)(s - 1);
                        if (s > send || !((*down & 0xc0) == 0x80)) {
-                           Perl_warn(aTHX_ "Malformed UTF-8 character");
+                           if (ckWARN_d(WARN_UTF8))
+                               Perl_warner(aTHX_ WARN_UTF8,
+                                           "Malformed UTF-8 character");
                            break;
                        }
                        while (down > up) {
@@ -4998,17 +4994,19 @@ PP(pp_split)
            s = m;
        }
     }
-    else if (rx->check_substr && !rx->nparens
+    else if ((rx->reganch & RE_USE_INTUIT) && !rx->nparens
             && (rx->reganch & ROPT_CHECK_ALL)
             && !(rx->reganch & ROPT_ANCH)) {
-       int tail = SvTAIL(rx->check_substr) != 0;
+       int tail = (rx->reganch & RE_INTUIT_TAIL);
+       SV *csv = CALLREG_INTUIT_STRING(aTHX_ rx);
+       char c;
 
-       i = SvCUR(rx->check_substr);
-       if (i == 1 && !tail) {
-           i = *SvPVX(rx->check_substr);
+       len = rx->minlen;
+       if (len == 1 && !tail) {
+           c = *SvPV(csv,len);
            while (--limit) {
                /*SUPPRESS 530*/
-               for (m = s; m < strend && *m != i; m++) ;
+               for (m = s; m < strend && *m != c; m++) ;
                if (m >= strend)
                    break;
                dstr = NEWSV(30, m-s);
@@ -5022,8 +5020,8 @@ PP(pp_split)
        else {
 #ifndef lint
            while (s < strend && --limit &&
-             (m=fbm_instr((unsigned char*)s, (unsigned char*)strend,
-                   rx->check_substr, PL_multiline ? FBMrf_MULTILINE : 0)) )
+             (m = fbm_instr((unsigned char*)s, (unsigned char*)strend,
+                            csv, PL_multiline ? FBMrf_MULTILINE : 0)) )
 #endif
            {
                dstr = NEWSV(31, m-s);
@@ -5031,14 +5029,18 @@ PP(pp_split)
                if (make_mortal)
                    sv_2mortal(dstr);
                XPUSHs(dstr);
-               s = m + i - tail;       /* Fake \n at the end */
+               s = m + len;            /* Fake \n at the end */
            }
        }
     }
     else {
        maxiters += (strend - s) * rx->nparens;
-       while (s < strend && --limit &&
-              CALLREGEXEC(aTHX_ rx, s, strend, orig, 1, sv, NULL, 0))
+       while (s < strend && --limit
+/*            && (!rx->check_substr 
+                  || ((s = CALLREG_INTUIT_START(aTHX_ rx, sv, s, strend,
+                                                0, NULL))))
+*/            && CALLREGEXEC(aTHX_ rx, s, strend, orig,
+                             1 /* minend */, sv, NULL, 0))
        {
            TAINT_IF(RX_MATCH_TAINTED(rx));
            if (RX_MATCH_COPIED(rx) && rx->subbeg != orig) {
@@ -5178,7 +5180,7 @@ PP(pp_lock)
        DEBUG_S(PerlIO_printf(PerlIO_stderr(), "0x%lx: pp_lock lock 0x%lx\n",
                              (unsigned long)thr, (unsigned long)sv);)
        MUTEX_UNLOCK(MgMUTEXP(mg));
-       save_destructor(Perl_unlock_condpair, sv);
+       SAVEDESTRUCTOR(Perl_unlock_condpair, sv);
     }
 #endif /* USE_THREADS */
     if (SvTYPE(retsv) == SVt_PVAV || SvTYPE(retsv) == SVt_PVHV