X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp_ctl.c;h=5cbf0a87ab0b715463ec44d20b7f9780d13f9be7;hb=7d4724f95a69a8d5a7cd565f21487912e6d331c0;hp=8b1159e0998d7740c647e91012a1b26c01b19003;hpb=3c10abe350e3df50f8ef0ac37c9d14175bc899f1;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp_ctl.c b/pp_ctl.c index 8b1159e..5cbf0a8 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -131,10 +131,18 @@ PP(pp_regcomp) if (!re || !re->precomp || re->prelen != (I32)len || memNE(re->precomp, t, len)) { + const regexp_engine *eng = re ? re->engine : NULL; + if (re) { 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 +154,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 @@ -283,7 +295,7 @@ PP(pp_substcont) SvUPGRADE(sv, SVt_PVMG); if (!(mg = mg_find(sv, PERL_MAGIC_regex_global))) { #ifdef PERL_OLD_COPY_ON_WRITE - if (SvIsCOW(lsv)) + if (SvIsCOW(sv)) sv_force_normal_flags(sv, 0); #endif mg = sv_magicext(sv, NULL, PERL_MAGIC_regex_global, &PL_vtbl_mglob, @@ -2438,13 +2450,13 @@ PP(pp_goto) SV **ary = AvALLOC(av); if (AvARRAY(av) != ary) { AvMAX(av) += AvARRAY(av) - AvALLOC(av); - SvPV_set(av, (char*)ary); + AvARRAY(av) = ary; } if (items >= AvMAX(av) + 1) { AvMAX(av) = items - 1; Renew(ary,items+1,SV*); AvALLOC(av) = ary; - SvPV_set(av, (char*)ary); + AvARRAY(av) = ary; } } ++mark; @@ -3154,6 +3166,7 @@ PP(pp_require) if (SvROK(dirsv)) { int count; + SV **svp; SV *loader = dirsv; if (SvTYPE(SvRV(loader)) == SVt_PVAV @@ -3181,6 +3194,11 @@ PP(pp_require) count = call_sv(loader, G_ARRAY); SPAGAIN; + /* Adjust file name if the hook has set an %INC entry */ + svp = hv_fetch(GvHVn(PL_incgv), name, len, 0); + if (svp) + tryname = SvPVX_const(*svp); + if (count > 0) { int i = 0; SV *arg; @@ -3443,8 +3461,6 @@ PP(pp_entereval) } sv = POPs; - if (!SvPV_nolen_const(sv)) - RETPUSHUNDEF; TAINT_PROPER("eval"); ENTER;