Plugin_comp(pTHX_ const SV * const pattern, const U32 flags)
#endif
{
- dSP;
- struct regexp *rx;
- REGEXP *RX;
-
- re__engine__Plugin re;
const xsh_hints_user_t *h;
-
+ REGEXP *RX;
+ struct regexp *rx;
+ re__engine__Plugin re;
+ char *pbuf;
STRLEN plen;
- char *pbuf;
-
- SV *obj;
+ SV *obj;
h = rep_hint();
if (!h) /* This looks like a pragma leak. Apply the default behaviour */
/* Our blessed object */
obj = newSV(0);
- Newxz(re, 1, struct replug);
+ XSH_LOCAL_ALLOC(re, 1, struct replug);
sv_setref_pv(obj, XSH_PACKAGE, (void *) re);
newREGEXP(RX);
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;
/* Call our callback function if one was defined, if not we've already set up
* all the stuff we're going to to need for subsequent exec and other calls */
if (h->comp) {
+ dSP;
+
ENTER;
SAVETMPS;
char *strbeg, REP_ENG_EXEC_MINEND_TYPE minend,
SV *sv, void *data, U32 flags)
{
- struct regexp *rx;
+ struct regexp *rx;
re__engine__Plugin self;
I32 matched;
void
Plugin_free(pTHX_ REGEXP * const RX)
{
- struct regexp *rx;
+ struct regexp *rx;
re__engine__Plugin self;
SV *callback;
- dSP;
if (PL_dirty)
return;
callback = self->cb_free;
if (callback) {
+ dSP;
+
ENTER;
SAVETMPS;
self->rx = NULL;
- Safefree(self);
+ XSH_LOCAL_FREE(self, 1, struct replug);
SvREFCNT_dec(rx->pprivate);
Plugin_numbered_buff_FETCH(pTHX_ REGEXP * const RX, const I32 paren,
SV * const sv)
{
- struct regexp *rx;
+ struct regexp *rx;
re__engine__Plugin self;
SV *callback;
Plugin_numbered_buff_STORE(pTHX_ REGEXP * const RX, const I32 paren,
SV const * const value)
{
- struct regexp *rx;
+ struct regexp *rx;
re__engine__Plugin self;
SV *callback;
Plugin_numbered_buff_LENGTH(pTHX_ REGEXP * const RX, const SV * const sv,
const I32 paren)
{
- struct regexp *rx;
+ struct regexp *rx;
re__engine__Plugin self;
SV *callback;