X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Magic.xs;h=483431e9eaa6925e4561837fc1f26ab66d51e42d;hb=3dac6abb6d4dfdbfe07b780d8b856b1d74eac970;hp=69ad981a726d862427de4e88d96de34b3a689432;hpb=670e590caf3db942b5e7feddc1e86669f9f46294;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/Magic.xs b/Magic.xs index 69ad981..483431e 100644 --- a/Magic.xs +++ b/Magic.xs @@ -331,8 +331,7 @@ static MAGIC *vmg_sv_magicext(pTHX_ SV *sv, SV *obj, const MGVTBL *vtbl, const v static I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, int (*cleanup)(pTHX_ void *), void *ud) { #define vmg_call_sv(S, F, C, U) vmg_call_sv(aTHX_ (S), (F), (C), (U)) - I32 ret, cxix; - PERL_CONTEXT saved_cx; + I32 ret; SV *old_err = NULL; if (SvTRUE(ERRSV)) { @@ -340,15 +339,8 @@ static I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, int (*cleanup)(pTHX_ void *), vo sv_setsv(ERRSV, &PL_sv_undef); } - cxix = (cxstack_ix < cxstack_max) ? (cxstack_ix + 1) : Perl_cxinc(aTHX); - /* 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]; - ret = call_sv(sv, flags | G_EVAL); - cxstack[cxix] = saved_cx; - if (SvTRUE(ERRSV)) { SvREFCNT_dec(old_err); @@ -857,6 +849,8 @@ static SV *vmg_data_new(pTHX_ SV *ctor, SV *sv, SV **args, I32 items) { ENTER; SAVETMPS; + PUSHSTACKi(PERLSI_MAGIC); + PUSHMARK(SP); EXTEND(SP, items + 1); PUSHs(sv_2mortal(newRV_inc(sv))); @@ -875,6 +869,8 @@ static SV *vmg_data_new(pTHX_ SV *ctor, SV *sv, SV **args, I32 items) { #endif PUTBACK; + POPSTACK; + FREETMPS; LEAVE; @@ -1260,6 +1256,8 @@ static int vmg_cb_call(pTHX_ SV *cb, unsigned int flags, SV *sv, ...) { ENTER; SAVETMPS; + PUSHSTACKi(PERLSI_MAGIC); + PUSHMARK(SP); EXTEND(SP, args + 1); PUSHs(sv_2mortal(newRV_inc(sv))); @@ -1294,6 +1292,8 @@ static int vmg_cb_call(pTHX_ SV *cb, unsigned int flags, SV *sv, ...) { svr = NULL; PUTBACK; + POPSTACK; + FREETMPS; LEAVE; @@ -1370,6 +1370,8 @@ static U32 vmg_svt_len(pTHX_ SV *sv, MAGIC *mg) { ENTER; SAVETMPS; + PUSHSTACKi(PERLSI_MAGIC); + PUSHMARK(SP); EXTEND(SP, 3); PUSHs(sv_2mortal(newRV_inc(sv))); @@ -1397,6 +1399,8 @@ static U32 vmg_svt_len(pTHX_ SV *sv, MAGIC *mg) { --ret; PUTBACK; + POPSTACK; + FREETMPS; LEAVE; @@ -1571,6 +1575,8 @@ static int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) { ENTER; SAVETMPS; + PUSHSTACKi(PERLSI_MAGIC); + PUSHMARK(SP); EXTEND(SP, 2); PUSHs(sv_2mortal(newRV_inc(sv))); @@ -1598,6 +1604,8 @@ static int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) { ret = (int) SvIV(svr); PUTBACK; + POPSTACK; + FREETMPS; LEAVE;