From: Vincent Pit Date: Wed, 4 Nov 2015 22:33:00 +0000 (-0200) Subject: Use more efficient stack manipulation macros X-Git-Tag: v0.11~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=991e3a83d9d13f22b3f639864a5d6c5cf31eb953;p=perl%2Fmodules%2Fre-engine-Plugin.git Use more efficient stack manipulation macros --- diff --git a/Plugin.xs b/Plugin.xs index c16dfba..296ca89 100644 --- a/Plugin.xs +++ b/Plugin.xs @@ -447,7 +447,7 @@ Plugin_numbered_buff_FETCH(pTHX_ REGEXP * const RX, const I32 paren, PUSHMARK(SP); XPUSHs(rx->pprivate); - XPUSHs(sv_2mortal(newSViv(paren))); + mXPUSHi(paren); PUTBACK; items = call_sv(callback, G_SCALAR); @@ -490,7 +490,7 @@ Plugin_numbered_buff_STORE(pTHX_ REGEXP * const RX, const I32 paren, PUSHMARK(SP); XPUSHs(rx->pprivate); - XPUSHs(sv_2mortal(newSViv(paren))); + mXPUSHi(paren); XPUSHs((SV *) value); PUTBACK; @@ -524,7 +524,7 @@ Plugin_numbered_buff_LENGTH(pTHX_ REGEXP * const RX, const SV * const sv, PUSHMARK(SP); XPUSHs(rx->pprivate); - XPUSHs(sv_2mortal(newSViv(paren))); + mXPUSHi(paren); PUTBACK; call_sv(callback, G_SCALAR); @@ -654,13 +654,11 @@ PPCODE: if (items > 1) { self->rx->minlen = (I32)SvIV(ST(1)); XSRETURN_EMPTY; - } else { - if (self->rx->minlen) { - XPUSHs(sv_2mortal(newSViv(self->rx->minlen))); - } else { - XPUSHs(sv_2mortal(&PL_sv_undef)); - } + } else if (self->rx->minlen) { + mXPUSHi(self->rx->minlen); XSRETURN(1); + } else { + XSRETURN_UNDEF; } void @@ -669,13 +667,11 @@ PPCODE: if (items > 1) { self->rx->gofs = (U32)SvIV(ST(1)); XSRETURN_EMPTY; - } else { - if (self->rx->gofs) { - XPUSHs(sv_2mortal(newSVuv(self->rx->gofs))); - } else { - XPUSHs(sv_2mortal(&PL_sv_undef)); - } + } else if (self->rx->gofs) { + mXPUSHu(self->rx->gofs); XSRETURN(1); + } else { + XSRETURN_UNDEF; } void @@ -684,13 +680,11 @@ PPCODE: if (items > 1) { self->rx->nparens = (U32)SvIV(ST(1)); XSRETURN_EMPTY; - } else { - if (self->rx->nparens) { - XPUSHs(sv_2mortal(newSVuv(self->rx->nparens))); - } else { - XPUSHs(sv_2mortal(&PL_sv_undef)); - } + } else if (self->rx->nparens) { + mXPUSHu(self->rx->nparens); XSRETURN(1); + } else { + XSRETURN_UNDEF; } void @@ -758,5 +752,5 @@ OUTPUT: void ENGINE() PPCODE: - XPUSHs(sv_2mortal(newSViv(PTR2IV(&engine_plugin)))); + mXPUSHi(PTR2IV(&engine_plugin)); XSRETURN(1);