X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=blobdiff_plain;f=Magic.xs;h=341950240c2934e870148a23b6f4a05304372f71;hp=9a07ac57e46d6e0785c665d7ebe5e4bdbd83c047;hb=9ed6790ce779d2ca91e392ceeb016d555658d8c0;hpb=a5ab162c9a0aa14e6caccd7104d719912115898f diff --git a/Magic.xs b/Magic.xs index 9a07ac5..3419502 100644 --- a/Magic.xs +++ b/Magic.xs @@ -285,8 +285,8 @@ STATIC I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, int (*cleanup)(pTHX_ void *), vo SV *old_err = NULL; if (SvTRUE(ERRSV)) { - old_err = ERRSV; - ERRSV = newSV(0); + old_err = newSVsv(ERRSV); + sv_setsv(ERRSV, &PL_sv_undef); } cxix = (cxstack_ix < cxstack_max) ? (cxstack_ix + 1) : Perl_cxinc(aTHX); @@ -299,11 +299,8 @@ STATIC I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, int (*cleanup)(pTHX_ void *), vo cxstack[cxix] = saved_cx; if (SvTRUE(ERRSV)) { - if (old_err) { - sv_setsv(old_err, ERRSV); - SvREFCNT_dec(ERRSV); - ERRSV = old_err; - } + SvREFCNT_dec(old_err); + if (IN_PERL_COMPILETIME) { if (!PL_in_eval) { if (PL_errors) @@ -326,8 +323,8 @@ STATIC I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, int (*cleanup)(pTHX_ void *), vo } } else { if (old_err) { - SvREFCNT_dec(ERRSV); - ERRSV = old_err; + sv_setsv(ERRSV, old_err); + SvREFCNT_dec(old_err); } } @@ -1378,8 +1375,8 @@ STATIC OP *vmg_pp_propagate_errsv(pTHX) { SVOP *o = cSVOPx(PL_op); if (o->op_sv) { - SvREFCNT_dec(ERRSV); - ERRSV = o->op_sv; + sv_setsv(ERRSV, o->op_sv); + SvREFCNT_dec(o->op_sv); o->op_sv = NULL; }