diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-05-28 20:50:28 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-05-28 20:50:28 +0000 |
commit | 4ee3650ee977c6bdf13c668373fcfbfd0ae799dd (patch) | |
tree | 0d3af9d411a8338842f919eb08e9309e4b2eaf09 /regexec.c | |
parent | 6425a2785dcc3334dbe645b343e3fc08008b28ca (diff) | |
download | perl-4ee3650ee977c6bdf13c668373fcfbfd0ae799dd.tar.gz |
fix accidental pessimization in RE optimizer (from Ilya Zakharevich)
p4raw-id: //depot/perl@6151
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -599,9 +599,10 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, find_anchor: while (t < strend - prog->minlen) { if (*t == '\n') { - if (t < s - prog->check_offset_min) { + if (t < check_at - prog->check_offset_min) { if (prog->anchored_substr) { - /* We definitely contradict the found anchored + /* Since we moved from the found position, + we definitely contradict the found anchored substr. Due to the above check we do not contradict "check" substr. Thus we can arrive here only if check substr @@ -612,12 +613,17 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, PL_colors[0],PL_colors[1], (long)(strpos - i_strpos), (long)(strpos - i_strpos + prog->anchored_offset))); goto do_other_anchored; } + /* We don't contradict the found floating substring. */ + /* XXXX Why not check for STCLASS? */ s = t + 1; DEBUG_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m at offset %ld...\n", PL_colors[0],PL_colors[1], (long)(s - i_strpos))); goto set_useful; } - DEBUG_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m, restarting at offset %ld...\n", + /* Position contradicts check-string */ + /* XXXX probably better to look for check-string + than for "\n", so one should lower the limit for t? */ + DEBUG_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m, restarting lookup for check-string at offset %ld...\n", PL_colors[0],PL_colors[1], (long)(t + 1 - i_strpos))); strpos = s = t + 1; goto restart; |