From: Vincent Pit Date: Wed, 4 Nov 2015 17:54:19 +0000 (-0200) Subject: Revamp helpers variable declarations X-Git-Tag: v0.11~9 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=86028c40f81b6806a812a32a2e43a17fcefefaee;p=perl%2Fmodules%2Fre-engine-Plugin.git Revamp helpers variable declarations In particular, get rid of GET_SELF_FROM_PPRIVATE(). --- diff --git a/Plugin.xs b/Plugin.xs index 9004ade..90e63fc 100644 --- a/Plugin.xs +++ b/Plugin.xs @@ -75,10 +75,6 @@ static void xsh_hints_user_deinit(pTHX_ xsh_hints_user_t *hv) { /* --- Custom regexp engine ------------------------------------------------ */ -#define GET_SELF_FROM_PPRIVATE(pprivate) \ - re__engine__Plugin self; \ - SELF_FROM_PPRIVATE(self,pprivate); - /* re__engine__Plugin self; SELF_FROM_PPRIVATE(self,rx->pprivate) */ #define SELF_FROM_PPRIVATE(self, pprivate) \ if (sv_isobject(pprivate)) { \ @@ -285,14 +281,16 @@ Plugin_exec(pTHX_ REGEXP * const RX, char *stringarg, char *strend, char *strbeg, REP_ENG_EXEC_MINEND_TYPE minend, SV *sv, void *data, U32 flags) { - dSP; + struct regexp *rx; + re__engine__Plugin self; I32 matched; - struct regexp *rx = rxREGEXP(RX); - GET_SELF_FROM_PPRIVATE(rx->pprivate); + rx = rxREGEXP(RX); + SELF_FROM_PPRIVATE(self, rx->pprivate); if (self->cb_exec) { SV *ret; + dSP; /* Store the current str for ->str */ SvREFCNT_dec(self->str); @@ -420,16 +418,19 @@ void Plugin_numbered_buff_FETCH(pTHX_ REGEXP * const RX, const I32 paren, SV * const sv) { - dSP; - I32 items; + struct regexp *rx; + re__engine__Plugin self; SV *callback; - struct regexp *rx = rxREGEXP(RX); - GET_SELF_FROM_PPRIVATE(rx->pprivate); + rx = rxREGEXP(RX); + SELF_FROM_PPRIVATE(self, rx->pprivate); callback = self->cb_num_capture_buff_FETCH; if (callback) { + I32 items; + dSP; + ENTER; SAVETMPS; @@ -461,15 +462,18 @@ void Plugin_numbered_buff_STORE(pTHX_ REGEXP * const RX, const I32 paren, SV const * const value) { - dSP; + struct regexp *rx; + re__engine__Plugin self; SV *callback; - struct regexp *rx = rxREGEXP(RX); - GET_SELF_FROM_PPRIVATE(rx->pprivate); + rx = rxREGEXP(RX); + SELF_FROM_PPRIVATE(self, rx->pprivate); callback = self->cb_num_capture_buff_STORE; if (callback) { + dSP; + ENTER; SAVETMPS; @@ -491,16 +495,18 @@ I32 Plugin_numbered_buff_LENGTH(pTHX_ REGEXP * const RX, const SV * const sv, const I32 paren) { - dSP; + struct regexp *rx; + re__engine__Plugin self; SV *callback; - struct regexp *rx = rxREGEXP(RX); - GET_SELF_FROM_PPRIVATE(rx->pprivate); + rx = rxREGEXP(RX); + SELF_FROM_PPRIVATE(self, rx->pprivate); callback = self->cb_num_capture_buff_LENGTH; if (callback) { IV ret; + dSP; ENTER; SAVETMPS;