X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fre-engine-Plugin.git;a=blobdiff_plain;f=Plugin.xs;fp=Plugin.xs;h=b06aec6365ed78bf08976da2b3fb6d4e28d3cb84;hp=296ca897771e0709027f49be25f0be11977a62c9;hb=96b646d76e0cb5f51a070f66fe4a4c1489eaf2e0;hpb=991e3a83d9d13f22b3f639864a5d6c5cf31eb953 diff --git a/Plugin.xs b/Plugin.xs index 296ca89..b06aec6 100644 --- a/Plugin.xs +++ b/Plugin.xs @@ -213,7 +213,7 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) /* Our blessed object */ obj = newSV(0); - Newxz(re, 1, struct replug); + Newx(re, 1, struct replug); sv_setref_pv(obj, XSH_PACKAGE, (void *) re); newREGEXP(RX); @@ -245,18 +245,17 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) re->pattern = (SV *) pattern; SvREFCNT_inc_simple_void(re->pattern); - /* If there's an exec callback, store it into the private object so that it - * will be the one to be called, even if the engine changes in between */ - if (h->exec) { - re->cb_exec = h->exec; - SvREFCNT_inc_simple_void_NN(h->exec); - } + re->str = NULL; + re->stash = NULL; - /* Same goes for the free callback, if there's one. */ - if (h->free) { - re->cb_free = h->free; - SvREFCNT_inc_simple_void_NN(h->free); - } + /* Store the default exec callback (which may be NULL) into the regexp + * object. */ + re->cb_exec = h->exec; + SvREFCNT_inc_simple_void(h->exec); + + /* Same goes for the free callback. */ + re->cb_free = h->free; + SvREFCNT_inc_simple_void(h->free); re->cb_num_capture_buff_FETCH = NULL; re->cb_num_capture_buff_STORE = NULL;