diff options
author | markm <markm@FreeBSD.org> | 1999-05-02 14:33:17 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 1999-05-02 14:33:17 +0000 |
commit | 77644ee620b6a79cf8c538abaf7cd301a875528d (patch) | |
tree | b4adabf341898a4378f4b7f8c7fb65f3f7c77769 /contrib/perl5/regexec.c | |
parent | 4fcbc3669aa997848e15198cc9fb856287a6788c (diff) | |
download | FreeBSD-src-77644ee620b6a79cf8c538abaf7cd301a875528d.zip FreeBSD-src-77644ee620b6a79cf8c538abaf7cd301a875528d.tar.gz |
Maintenance releace 3 of perl5.005. Includes support for threads.
Diffstat (limited to 'contrib/perl5/regexec.c')
-rw-r--r-- | contrib/perl5/regexec.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/contrib/perl5/regexec.c b/contrib/perl5/regexec.c index f8c5e7e..98f7ef5 100644 --- a/contrib/perl5/regexec.c +++ b/contrib/perl5/regexec.c @@ -62,7 +62,7 @@ * **** Alterations to Henry's code are... **** - **** Copyright (c) 1991-1997, Larry Wall + **** Copyright (c) 1991-1999, Larry Wall **** **** You may distribute under the terms of either the GNU General Public **** License or the Artistic License, as specified in the README file. @@ -1573,6 +1573,7 @@ regmatch(regnode *prog) sayYES; /* Success! */ case SUSPEND: n = 1; + PL_reginput = locinput; goto do_ifmatch; case UNLESSM: n = 0; @@ -1768,25 +1769,26 @@ regrepeat_hard(regnode *p, I32 max, I32 *lp) register char *scan; register char *start; register char *loceol = PL_regeol; - I32 l = -1; + I32 l = 0; + I32 count = 0, res = 1; + + if (!max) + return 0; start = PL_reginput; - while (PL_reginput < loceol && (scan = PL_reginput, regmatch(p))) { - if (l == -1) { + while (PL_reginput < loceol && (scan = PL_reginput, res = regmatch(p))) { + if (!count++) { *lp = l = PL_reginput - start; if (max != REG_INFTY && l*max < loceol - scan) loceol = scan + l*max; - if (l == 0) { + if (l == 0) return max; - } } } - if (PL_reginput < loceol) + if (!res) PL_reginput = scan; - else - scan = PL_reginput; - return (scan - start)/l; + return count; } /* |