summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-06-09 14:14:27 -0400
committerGurusamy Sarathy <gsar@cpan.org>1999-07-06 09:05:02 +0000
commitf722798beaa437498e1f879b01996be44f2fdc1a (patch)
tree89f77d510121aa9a3b67c8d66e7f9c37783b143e /pp.c
parent572bbb43c768e4239ddeb3245621277ab450fe70 (diff)
downloadperl-f722798beaa437498e1f879b01996be44f2fdc1a.tar.gz
applied slightly tweaked version of suggested patch for
improved RE API Message-Id: <199906092214.SAA14126@monk.mps.ohio-state.edu> Subject: [PATCH 5.005_57] REx engine rehash p4raw-id: //depot/perl@3606
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/pp.c b/pp.c
index e688848d9c..d28a8c21d6 100644
--- a/pp.c
+++ b/pp.c
@@ -4998,17 +4998,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);
+ i = rx->minlen;
if (i == 1 && !tail) {
- i = *SvPVX(rx->check_substr);
+ c = *SvPV(csv,i);
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 +5024,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 +5033,18 @@ PP(pp_split)
if (make_mortal)
sv_2mortal(dstr);
XPUSHs(dstr);
- s = m + i - tail; /* Fake \n at the end */
+ s = m + i; /* 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) {