diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 1999-05-24 22:42:23 -0400 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-25 09:14:51 +0000 |
commit | cf93c79d660ae36ccc5f83d949c599473fc522ce (patch) | |
tree | 990c1003b82a9b439144bee4075daab1ba3d13d9 /pp.c | |
parent | a99f88279527854d73f6b517b869d613f02be3d1 (diff) | |
download | perl-cf93c79d660ae36ccc5f83d949c599473fc522ce.tar.gz |
REx engine improvements
Message-Id: <199905250642.CAA06208@monk.mps.ohio-state.edu>
p4raw-id: //depot/perl@3475
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -5006,8 +5006,10 @@ PP(pp_split) else if (rx->check_substr && !rx->nparens && (rx->reganch & ROPT_CHECK_ALL) && !(rx->reganch & ROPT_ANCH)) { + int tail = SvTAIL(rx->check_substr) != 0; + i = SvCUR(rx->check_substr); - if (i == 1 && !SvTAIL(rx->check_substr)) { + if (i == 1 && !tail) { i = *SvPVX(rx->check_substr); while (--limit) { /*SUPPRESS 530*/ @@ -5026,7 +5028,7 @@ PP(pp_split) #ifndef lint while (s < strend && --limit && (m=fbm_instr((unsigned char*)s, (unsigned char*)strend, - rx->check_substr, 0)) ) + rx->check_substr, PL_multiline ? FBMrf_MULTILINE : 0)) ) #endif { dstr = NEWSV(31, m-s); @@ -5034,7 +5036,7 @@ PP(pp_split) if (make_mortal) sv_2mortal(dstr); XPUSHs(dstr); - s = m + i; + s = m + i - tail; /* Fake \n at the end */ } } } @@ -5044,15 +5046,14 @@ PP(pp_split) CALLREGEXEC(rx, s, strend, orig, 1, sv, NULL, 0)) { TAINT_IF(RX_MATCH_TAINTED(rx)); - if (rx->subbase - && rx->subbase != orig) { + if (RX_MATCH_COPIED(rx) && rx->subbeg != orig) { m = s; s = orig; - orig = rx->subbase; + orig = rx->subbeg; s = orig + (m - s); strend = s + (strend - m); } - m = rx->startp[0]; + m = rx->startp[0] + orig; dstr = NEWSV(32, m-s); sv_setpvn(dstr, s, m-s); if (make_mortal) @@ -5060,8 +5061,8 @@ PP(pp_split) XPUSHs(dstr); if (rx->nparens) { for (i = 1; i <= rx->nparens; i++) { - s = rx->startp[i]; - m = rx->endp[i]; + s = rx->startp[i] + orig; + m = rx->endp[i] + orig; if (m && s) { dstr = NEWSV(33, m-s); sv_setpvn(dstr, s, m-s); @@ -5073,7 +5074,7 @@ PP(pp_split) XPUSHs(dstr); } } - s = rx->endp[0]; + s = rx->endp[0] + orig; } } |