summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-03-17 02:57:45 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-03-17 02:57:45 +0000
commitd83d022c5cbb9289f9c20b08fe42428075463c25 (patch)
treed6d55250537ddf8a853b2a7ad0f7fddded4277ff /regexec.c
parente07ea26af5fdde170ce4e4e0a797a364c6a185e6 (diff)
downloadperl-d83d022c5cbb9289f9c20b08fe42428075463c25.tar.gz
reduce S_regrepeat_hard() callers from 3 to 1
p4raw-id: //depot/perl@27526
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/regexec.c b/regexec.c
index ccafd0711a..eb2480cda1 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3714,6 +3714,7 @@ S_regmatch(pTHX_ regnode *prog)
{
I32 l = 0;
CHECKPOINT lastcp;
+ I32 count;
/* We suppose that the next guy does not need
backtracking: in particular, it is of constant non-zero length,
@@ -3731,9 +3732,12 @@ S_regmatch(pTHX_ regnode *prog)
if (paren)
scan += NEXT_OFF(scan); /* Skip former OPEN. */
PL_reginput = locinput;
+ count = minmod ? ln : n;
+ if (count)
+ count = regrepeat_hard(scan, count, &l);
if (minmod) {
minmod = 0;
- if (ln && regrepeat_hard(scan, ln, &l) < ln)
+ if (ln && count < ln)
sayNO;
locinput = PL_reginput;
if (HAS_TEXT(next) || JUMPABLE(next)) {
@@ -3781,7 +3785,7 @@ S_regmatch(pTHX_ regnode *prog)
}
/* Couldn't or didn't -- move forward. */
PL_reginput = locinput;
- if (regrepeat_hard(scan, 1, &l)) {
+ if (regmatch(scan)) {
ln++;
locinput = PL_reginput;
}
@@ -3790,7 +3794,7 @@ S_regmatch(pTHX_ regnode *prog)
}
}
else {
- n = regrepeat_hard(scan, n, &l);
+ n = count;
locinput = PL_reginput;
DEBUG_EXECUTE_r(
PerlIO_printf(Perl_debug_log,