#endif /* REP_WORKAROUND_REQUIRE_PROPAGATION */
#if REP_THREADSAFE
- /* We only need for the key to be an unique tag for looking up the value later.
- * Allocated memory provides convenient unique identifiers, so that's why we
- * use the hint as the key itself. */
- ptable_store(MY_CXT.tbl, h, h);
+ {
+ dMY_CXT;
+ /* We only need for the key to be an unique tag for looking up the value later
+ * Allocated memory provides convenient unique identifiers, so that's why we
+ * use the hint as the key itself. */
+ ptable_store(MY_CXT.tbl, h, h);
+ }
#endif /* REP_THREADSAFE */
return newSViv(PTR2IV(h));
STATIC const rep_hint_t *rep_detag(pTHX_ const SV *hint) {
#define rep_detag(H) rep_detag(aTHX_ (H))
rep_hint_t *h;
- dMY_CXT;
if (!(hint && SvIOK(hint)))
return NULL;
h = INT2PTR(rep_hint_t *, SvIVX(hint));
#if REP_THREADSAFE
- h = ptable_fetch(MY_CXT.tbl, h);
+ {
+ dMY_CXT;
+ h = ptable_fetch(MY_CXT.tbl, h);
+ }
#endif /* REP_THREADSAFE */
#if REP_WORKAROUND_REQUIRE_PROPAGATION
STATIC U32 rep_initialized = 0;
STATIC void rep_teardown(pTHX_ void *root) {
- dMY_CXT;
-
if (!rep_initialized || aTHX != root)
return;
- ptable_free(MY_CXT.tbl);
+ {
+ dMY_CXT;
+ ptable_free(MY_CXT.tbl);
+ }
rep_initialized = 0;
}
if (rep_initialized)
return;
- MY_CXT_INIT;
- MY_CXT.tbl = ptable_new();
- MY_CXT.owner = aTHX;
+ {
+ MY_CXT_INIT;
+ MY_CXT.tbl = ptable_new();
+ MY_CXT.owner = aTHX;
+ }
call_atexit(rep_teardown, aTHX);