From: Vincent Pit Date: Sun, 5 Aug 2012 10:39:26 +0000 (+0200) Subject: Always enable VMG_SAVE_LAST_CX X-Git-Tag: v0.51~13 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=4591803a480417f70ed1f166ea4433facfddefd4;p=perl%2Fmodules%2FVariable-Magic.git Always enable VMG_SAVE_LAST_CX This allows to remove the special case of only setting in_eval when we are in a destructor. --- diff --git a/Magic.xs b/Magic.xs index d3d17bf..d87c651 100644 --- a/Magic.xs +++ b/Magic.xs @@ -222,14 +222,10 @@ STATIC void vmg_mg_magical(SV *sv) { /* ... Safe version of call_sv() ........................................... */ -#define VMG_SAVE_LAST_CX (!VMG_HAS_PERL(5, 8, 4) || VMG_HAS_PERL(5, 9, 5)) - STATIC I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, SV *dsv) { #define vmg_call_sv(S, F, D) vmg_call_sv(aTHX_ (S), (F), (D)) - I32 ret, cxix = 0, in_eval = 0; -#if VMG_SAVE_LAST_CX + I32 ret, cxix, in_eval = 0; PERL_CONTEXT saved_cx; -#endif SV *old_err = NULL; if (SvTRUE(ERRSV)) { @@ -238,22 +234,18 @@ STATIC I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, SV *dsv) { } if (cxstack_ix < cxstack_max) { - cxix = cxstack_ix + 1; - if (dsv && CxTYPE(cxstack + cxix) == CXt_EVAL) - in_eval = 1; + cxix = cxstack_ix + 1; + in_eval = CxTYPE(cxstack + cxix) == CXt_EVAL; + } else { + cxix = Perl_cxinc(aTHX); } - -#if VMG_SAVE_LAST_CX /* The last popped context will be reused by call_sv(), but our callers may * still need its previous value. Back it up so that it isn't clobbered. */ saved_cx = cxstack[cxix]; -#endif ret = call_sv(sv, flags | G_EVAL); -#if VMG_SAVE_LAST_CX cxstack[cxix] = saved_cx; -#endif if (SvTRUE(ERRSV)) { if (old_err) {