From: Vincent Pit Date: Wed, 27 Aug 2008 19:17:17 +0000 (+0200) Subject: Replace XPUSHs by EXTEND/PUSHs X-Git-Tag: v0.20~24 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=8d799ecef898c3eae133d58ce629b9b2340c0ac2;p=perl%2Fmodules%2FVariable-Magic.git Replace XPUSHs by EXTEND/PUSHs --- diff --git a/Magic.xs b/Magic.xs index ba23045..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);