summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-10-18 22:51:41 +0200
committerNicholas Clark <nick@ccl4.org>2006-10-19 20:52:31 +0000
commit1e2e3d022b3464fbde4734646678d89865859418 (patch)
treea8dedc1e0adf28e9b2ba548c114b4467906655bd /pp_ctl.c
parent768fd1576db46dc9f6fdf8c63b324c4bc79a426a (diff)
downloadperl-1e2e3d022b3464fbde4734646678d89865859418.tar.gz
Re: Off by one in the trie code?
Message-ID: <9b18b3110610181151i3ca438cdied769ebaa4255079@mail.gmail.com> 1. code necessary to make patterns with interpolated vars behave correctly under lexical re 'debug', including additional tests. 2. changes necessary to resolve the off by one error, 3. tweaks to re.pm to document that re 'debug' is lexical, p4raw-id: //depot/perl@29057
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 8b1159e099..0a59e6234b 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -131,10 +131,19 @@ PP(pp_regcomp)
if (!re || !re->precomp || re->prelen != (I32)len ||
memNE(re->precomp, t, len))
{
+ regexp_engine * eng = NULL;
+
if (re) {
+ eng = re->engine;
ReREFCNT_dec(re);
PM_SETRE(pm, NULL); /* crucial if regcomp aborts */
+ } else if (PL_curcop->cop_hints_hash) {
+ SV *ptr = Perl_refcounted_he_fetch(aTHX_ PL_curcop->cop_hints_hash, 0,
+ "regcomp", 7, 0, 0);
+ if (ptr && SvIOK(ptr) && SvIV(ptr))
+ eng = INT2PTR(regexp_engine*,SvIV(ptr));
}
+
if (PL_op->op_flags & OPf_SPECIAL)
PL_reginterp_cnt = I32_MAX; /* Mark as safe. */
@@ -146,7 +155,11 @@ PP(pp_regcomp)
if (pm->op_pmdynflags & PMdf_UTF8)
t = (char*)bytes_to_utf8((U8*)t, &len);
}
- PM_SETRE(pm, CALLREGCOMP((char *)t, (char *)t + len, pm));
+ if (eng)
+ PM_SETRE(pm, CALLREGCOMP_ENG(eng,(char *)t, (char *)t + len, pm));
+ else
+ PM_SETRE(pm, CALLREGCOMP((char *)t, (char *)t + len, pm));
+
if (!DO_UTF8(tmpstr) && (pm->op_pmdynflags & PMdf_UTF8))
Safefree(t);
PL_reginterp_cnt = 0; /* XXXX Be extra paranoid - needed