/* ... Thread safety and multiplicity ...................................... */
+/* Safe unless stated otherwise in Makefile.PL */
+#ifndef REP_FORKSAFE
+# define REP_FORKSAFE 1
+#endif
+
#ifndef REP_MULTIPLICITY
# if defined(MULTIPLICITY) || defined(PERL_IMPLICIT_CONTEXT)
# define REP_MULTIPLICITY 1
STATIC SV *rep_tag(pTHX_ SV *comp, SV *exec) {
#define rep_tag(C, E) rep_tag(aTHX_ (C), (E))
rep_hint_t *h;
- dMY_CXT;
h = PerlMemShared_malloc(sizeof *h);
h->comp = rep_validate_callback(comp);
* already set up all the stuff we're going to to need for
* subsequent exec and other calls */
if (h->comp) {
- ENTER;
+ ENTER;
SAVETMPS;
-
+
PUSHMARK(SP);
XPUSHs(obj);
PUTBACK;
ENTER;
SAVETMPS;
-
+
PUSHMARK(SP);
XPUSHs(rx->pprivate);
XPUSHs(sv);
PUTBACK;
call_sv(self->cb_exec, G_SCALAR);
-
+
SPAGAIN;
ret = POPs;
void
Plugin_free(pTHX_ REGEXP * const RX)
{
- struct regexp *rx = rxREGEXP(RX);
- GET_SELF_FROM_PPRIVATE(rx->pprivate);
+ struct regexp *rx;
+ re__engine__Plugin self;
+
+ if (PL_dirty)
+ return;
+
+ rx = rxREGEXP(RX);
+ SELF_FROM_PPRIVATE(self, rx->pprivate);
SvREFCNT_dec(self->pattern);
SvREFCNT_dec(self->str);
if (callback) {
ENTER;
SAVETMPS;
-
+
PUSHMARK(SP);
XPUSHs(rx->pprivate);
PUTBACK;
if (callback) {
ENTER;
SAVETMPS;
-
+
PUSHMARK(SP);
XPUSHs(rx->pprivate);
XPUSHs(sv_2mortal(newSViv(paren)));
PUTBACK;
items = call_sv(callback, G_SCALAR);
-
+
if (items == 1) {
SV *ret;
if (callback) {
ENTER;
SAVETMPS;
-
+
PUSHMARK(SP);
XPUSHs(rx->pprivate);
XPUSHs(sv_2mortal(newSViv(paren)));
ENTER;
SAVETMPS;
-
+
PUSHMARK(SP);
XPUSHs(rx->pprivate);
XPUSHs(sv_2mortal(newSViv(paren)));
BOOT:
{
if (!rep_booted++) {
+ HV *stash;
+
PERL_HASH(rep_hash, __PACKAGE__, __PACKAGE_LEN__);
+
+ stash = gv_stashpvn(__PACKAGE__, __PACKAGE_LEN__, 1);
+ newCONSTSUB(stash, "REP_THREADSAFE", newSVuv(REP_THREADSAFE));
+ newCONSTSUB(stash, "REP_FORKSAFE", newSVuv(REP_FORKSAFE));
}
rep_setup();