From: Andy Lester Date: Sun, 16 Apr 2006 23:40:35 +0000 (-0500) Subject: pp_ctl.c caching X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d8f6592eee7fae0c2b8d86f88fb82ba0481c1967;p=p5sagit%2Fp5-mst-13.2.git pp_ctl.c caching Message-ID: <20060417044035.GA28818@petdance.com> Date: Sun, 16 Apr 2006 23:40:35 -0500 p4raw-id: //depot/perl@27860 --- diff --git a/pp_ctl.c b/pp_ctl.c index f88e91d..acefb21 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -113,7 +113,7 @@ PP(pp_regcomp) tmpstr = POPs; if (SvROK(tmpstr)) { - SV *sv = SvRV(tmpstr); + SV * const sv = SvRV(tmpstr); if(SvMAGICAL(sv)) mg = mg_find(sv, PERL_MAGIC_qr); } @@ -125,14 +125,14 @@ PP(pp_regcomp) else { STRLEN len; const char *t = SvPV_const(tmpstr, len); + regexp * const re = PM_GETRE(pm); /* Check against the last compiled regexp. */ - if (!PM_GETRE(pm) || !PM_GETRE(pm)->precomp || - PM_GETRE(pm)->prelen != (I32)len || - memNE(PM_GETRE(pm)->precomp, t, len)) + if (!re || !re->precomp || re->prelen != (I32)len || + memNE(re->precomp, t, len)) { - if (PM_GETRE(pm)) { - ReREFCNT_dec(PM_GETRE(pm)); + if (re) { + ReREFCNT_dec(re); PM_SETRE(pm, NULL); /* crucial if regcomp aborts */ } if (PL_op->op_flags & OPf_SPECIAL)