From 30382c73ff93b57b951492a5a0d1cba2de577e49 Mon Sep 17 00:00:00 2001 From: Ilya Zakharevich Date: Mon, 4 Oct 1999 15:58:03 -0400 Subject: Re: Strange RE engine breakage in 5_61 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: François Désarménien Cc: "perl5-porters@perl.org" Message-ID: <19991004195803.A21760@monk.mps.ohio-state.edu> (had to apply pat.t part manually because there already were more tests than there was in _61) p4raw-id: //depot/cfgperl@4301 --- regexec.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'regexec.c') diff --git a/regexec.c b/regexec.c index a567353311..048ae491a1 100644 --- a/regexec.c +++ b/regexec.c @@ -739,19 +739,23 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * /* If there is a "must appear" string, look for it. */ s = startpos; - if (prog->reganch & ROPT_GPOS_SEEN) { + if (prog->reganch & ROPT_GPOS_SEEN) { /* Need to have PL_reg_ganch */ MAGIC *mg; - if (!(flags & REXEC_IGNOREPOS) && sv && SvTYPE(sv) >= SVt_PVMG - && SvMAGIC(sv) && (mg = mg_find(sv, 'g')) && mg->mg_len >= 0) - PL_reg_ganch = strbeg + mg->mg_len; - else + if (flags & REXEC_IGNOREPOS) /* Means: check only at start */ PL_reg_ganch = startpos; - if (prog->reganch & ROPT_ANCH_GPOS) { - if (s > PL_reg_ganch) - goto phooey; - s = PL_reg_ganch; + else if (sv && SvTYPE(sv) >= SVt_PVMG + && SvMAGIC(sv) + && (mg = mg_find(sv, 'g')) && mg->mg_len >= 0) { + PL_reg_ganch = strbeg + mg->mg_len; /* Defined pos() */ + if (prog->reganch & ROPT_ANCH_GPOS) { + if (s > PL_reg_ganch) + goto phooey; + s = PL_reg_ganch; + } } + else /* pos() not defined */ + PL_reg_ganch = strbeg; } if (!(flags & REXEC_CHECKED) && prog->check_substr != Nullsv) { -- cgit v1.2.1