summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>2000-09-28 17:55:31 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2000-10-02 23:48:58 +0000
commit5675c1a6395a0842c857fc8de159747577df6c4b (patch)
tree3994454f34bab2ebf3e08d4fd0b7c993fd259abd /regexec.c
parent8894c26d2b4c3352c1581a0320acc34e8fc1801a (diff)
downloadperl-5675c1a6395a0842c857fc8de159747577df6c4b.tar.gz
Minor optimization in re_intuit_start
Message-ID: <20000928215531.A4315@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@7115
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/regexec.c b/regexec.c
index ea523831c2..d3f2065cbc 100644
--- a/regexec.c
+++ b/regexec.c
@@ -357,17 +357,18 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
|| ( (prog->reganch & ROPT_ANCH_BOL)
&& !PL_multiline ) ); /* Check after \n? */
- if ((prog->check_offset_min == prog->check_offset_max) && !ml_anch) {
+ if (!ml_anch) {
+ if ( !(prog->reganch & ROPT_ANCH_GPOS) /* Checked by the caller */
+ /* SvCUR is not set on references: SvRV and SvPVX overlap */
+ && sv && !SvROK(sv)
+ && (strpos + SvCUR(sv) != strend)) {
+ DEBUG_r(PerlIO_printf(Perl_debug_log, "Not at start...\n"));
+ goto fail;
+ }
+ if (prog->check_offset_min == prog->check_offset_max) {
/* Substring at constant offset from beg-of-str... */
I32 slen;
- if ( !(prog->reganch & ROPT_ANCH_GPOS) /* Checked by the caller */
- /* SvCUR is not set on references: SvRV and SvPVX overlap */
- && sv && !SvROK(sv)
- && (strpos + SvCUR(sv) != strend)) {
- DEBUG_r(PerlIO_printf(Perl_debug_log, "Not at start...\n"));
- goto fail;
- }
PL_regeol = strend; /* Used in HOP() */
s = HOPc(strpos, prog->check_offset_min);
if (SvTAIL(check)) {
@@ -393,6 +394,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
&& memNE(SvPVX(check), s, slen)))
goto report_neq;
goto success_at_start;
+ }
}
/* Match is anchored, but substr is not anchored wrt beg-of-str. */
s = strpos;