On Sun, Jun 05, 2016 at 08:39:20PM +0200, Vincent Pit (VPIT) wrote: > I just have a small question regarding commit ded730eb9 ("get su_init/su_pop > working under 5.23.8"). In su_localize, you added this snippet : > > ======================================================================= > > + > +/* new perl context implementation frees savestack *before* restoring > + * PL_curcop. Temporarily restore it prematurely to make gv_fetch* > + * looks up unqualified var names in the caller's package */ > +#ifdef SU_HAS_NEW_CXT > + COP *old_cop = PL_curcop; > + PL_curcop = CX_CUR()->blk_oldcop; > +#endif > + > #ifdef gv_fetchsv > gv = gv_fetchsv(sv, GV_ADDMULTI, t); > #else > @@ -896,13 +926,16 @@ static void su_localize(pTHX_ void *ud_) { > const char *name = SvPV_const(sv, len); > gv = gv_fetchpvn_flags(name, len, GV_ADDMULTI, t); > #endif > +#ifdef SU_HAS_NEW_CXT > + CX_CUR()->blk_oldcop = PL_curcop; > +#endif > > ======================================================================= > > but as far as I can tell this old_cop variable is never used. Since the > tests pass with this change, does it mean that it can be removed? Hmmm... the second chunk of that diff was *supposed* to be PL_curcop = old_cop; which would make it logically correct, although I *think* that in practice, since su_pop() frees all items in the current savestack frame below itself before calling su_localize(), so su_localize() is effectively always called after all the other savestack items have been processed, its hard to think of test case where it matters. I'd recommend still changing it to PL_curcop = old_cop rather than removing it though. -- A major Starfleet emergency breaks out near the Enterprise, but fortunately some other ships in the area are able to deal with it to everyone's satisfaction. -- Things That Never Happen in "Star Trek" #13Thread Previous | Thread Next