diff options
author | Yves Orton <demerphq@gmail.com> | 2006-10-18 22:51:41 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-10-19 20:52:31 +0000 |
commit | 1e2e3d022b3464fbde4734646678d89865859418 (patch) | |
tree | a8dedc1e0adf28e9b2ba548c114b4467906655bd /pp_ctl.c | |
parent | 768fd1576db46dc9f6fdf8c63b324c4bc79a426a (diff) | |
download | perl-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.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -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 |