X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=op.c;h=bd8f65262926d2516f9c23ab2173fdcdf965e432;hb=11faa288e292c27cb2ddc4ccdc483b523d26ce19;hp=7e8d32e9b25647897ed2bf8620890160e487b5bf;hpb=57843af05bc7863df9b9bfb6b37e3a29d08532a9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/op.c b/op.c index 7e8d32e..bd8f652 100644 --- a/op.c +++ b/op.c @@ -776,7 +776,9 @@ S_cop_free(pTHX_ COP* cop) Safefree(cop->cop_label); #ifdef USE_ITHREADS Safefree(CopFILE(cop)); /* XXXXX share in a pvtable? */ + Safefree(CopSTASHPV(cop)); /* XXXXX share in a pvtable? */ #else + /* NOTE: COP.cop_stash is not refcounted */ SvREFCNT_dec(CopFILEGV(cop)); #endif if (! specialWARN(cop->cop_warnings)) @@ -3330,7 +3332,7 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o) #else CopFILEGV_set(cop, (GV*)SvREFCNT_inc(CopFILEGV(PL_curcop))); #endif - cop->cop_stash = PL_curstash; + CopSTASH_set(cop, PL_curstash); if (PERLDB_LINE && PL_curstash != PL_debstash) { SV **svp = av_fetch(CopFILEAV(PL_curcop), (I32)CopLINE(cop), FALSE); @@ -4496,15 +4498,24 @@ void Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv) { dTHR; - U32 oldhints = PL_hints; - HV *old_cop_stash = PL_curcop->cop_stash; - HV *old_curstash = PL_curstash; - line_t oldline = CopLINE(PL_curcop); - CopLINE_set(PL_curcop, PL_copline); + ENTER; + SAVECOPLINE(PL_curcop); + SAVEHINTS(); + + CopLINE_set(PL_curcop, PL_copline); PL_hints &= ~HINT_BLOCK_SCOPE; - if(stash) - PL_curstash = PL_curcop->cop_stash = stash; + + if (stash) { + SAVESPTR(PL_curstash); + SAVECOPSTASH(PL_curcop); + PL_curstash = stash; +#ifdef USE_ITHREADS + CopSTASHPV(PL_curcop) = stash ? HvNAME(stash) : Nullch; +#else + CopSTASH(PL_curcop) = stash; +#endif + } newATTRSUB( start_subparse(FALSE, 0), @@ -4514,10 +4525,7 @@ Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv) newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) ); - PL_hints = oldhints; - PL_curcop->cop_stash = old_cop_stash; - PL_curstash = old_curstash; - CopLINE_set(PL_curcop, oldline); + LEAVE; } CV *