X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Magic.xs;h=bfc75c9400048207f4e9ff5b59c980a14cc91b00;hb=b1c000770cd87f795f7d0873d82ea72d3d1601bd;hp=416bf7286e14adec3d4db96d83a05b8c83919131;hpb=aec8d8c69d06247ad948ef908268a57c27560920;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/Magic.xs b/Magic.xs index 416bf72..bfc75c9 100644 --- a/Magic.xs +++ b/Magic.xs @@ -181,6 +181,7 @@ typedef struct { STATIC SV *vmg_data_new(pTHX_ SV *ctor, SV *sv, AV *args) { #define vmg_data_new(C, S, A) vmg_data_new(aTHX_ (C), (S), (A)) SV *nsv; + I32 i, alen = (args == NULL) ? 0 : av_len(args); dSP; int count; @@ -189,11 +190,10 @@ STATIC SV *vmg_data_new(pTHX_ SV *ctor, SV *sv, AV *args) { SAVETMPS; PUSHMARK(SP); - XPUSHs(sv_2mortal(newRV_inc(sv))); - if (args != NULL) { - I32 i, alen = av_len(args); - for (i = 0; i < alen; ++i) { XPUSHs(*av_fetch(args, i, 0)); } - } + EXTEND(SP, alen + 1); + PUSHs(sv_2mortal(newRV_inc(sv))); + for (i = 0; i < alen; ++i) + PUSHs(*av_fetch(args, i, 0)); PUTBACK; count = call_sv(ctor, G_SCALAR); @@ -598,13 +598,11 @@ STATIC int vmg_wizard_free(pTHX_ SV *wiz, MAGIC *mg) { w = SV2MGWIZ(wiz); - SvREFCNT_inc(wiz); /* Fake survival - it's gonna be deleted anyway */ -#if PERL_VERSION_GE(5, 9, 5) - SvREFCNT_inc(wiz); /* One more push */ -#endif if (hv_delete(MY_CXT.wizz, buf, sprintf(buf, "%u", w->sig), 0)) { --MY_CXT.count; } + SvFLAGS(wiz) |= SVf_BREAK; + FREETMPS; if (w->cb_data != NULL) { SvREFCNT_dec(SvRV(w->cb_data)); } if (w->cb_get != NULL) { SvREFCNT_dec(SvRV(w->cb_get)); }