X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Plugin.xs;h=af917b7d7e1ff5dc07010c033d8a95df5dccc248;hb=5162655c3a86217e485be50e4f5266b7ff713d70;hp=9004adeed655e6ce3def1c5a7950f641945ce861;hpb=5aedd658d1e70fe63277bc50f162a16be1574d55;p=perl%2Fmodules%2Fre-engine-Plugin.git diff --git a/Plugin.xs b/Plugin.xs index 9004ade..af917b7 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); @@ -371,6 +369,7 @@ Plugin_free(pTHX_ REGEXP * const RX) SvREFCNT_dec(self->pattern); SvREFCNT_dec(self->str); + SvREFCNT_dec(self->stash); SvREFCNT_dec(self->cb_exec); @@ -420,16 +419,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 +463,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 +496,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;