# define HvNAMELEN_get(H) strlen(HvNAME_get(H))
#endif
-#ifndef OP_SIBLING
-# define OP_SIBLING(O) ((O)->op_sibling)
+#ifndef OpSIBLING
+# ifdef OP_SIBLING
+# define OpSIBLING(O) OP_SIBLING(O)
+# else
+# define OpSIBLING(O) ((O)->op_sibling)
+# endif
#endif
#define I_HAS_PERL(R, V, S) (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
STATIC SV *indirect_tag(pTHX_ SV *value) {
#define indirect_tag(V) indirect_tag(aTHX_ (V))
indirect_hint_t *h;
- SV *code = NULL;
+ SV *code = NULL;
+#if I_THREADSAFE
+ dMY_CXT;
+
+ if (!MY_CXT.tbl)
+ return newSViv(0);
+#endif /* I_THREADSAFE */
if (SvROK(value)) {
value = SvRV(value);
#endif /* !I_HINT_STRUCT */
#if I_THREADSAFE
- {
- 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_hints_store(MY_CXT.tbl, h, h);
- }
+ /* 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_hints_store(MY_CXT.tbl, h, h);
#endif /* I_THREADSAFE */
return newSViv(PTR2IV(h));
dMY_CXT;
#endif
+#if I_THREADSAFE
+ if (!MY_CXT.tbl)
+ return NULL;
+#endif /* I_THREADSAFE */
+
h = INT2PTR(indirect_hint_t *, SvIVX(hint));
#if I_THREADSAFE
h = ptable_fetch(MY_CXT.tbl, h);
STRLEN len;
dMY_CXT;
+ /* No need to check for MY_CXT.map != NULL because this code path is always
+ * guarded by indirect_hint(). */
+
if (!(oi = ptable_fetch(MY_CXT.map, o))) {
Newx(oi, 1, indirect_op_info_t);
ptable_store(MY_CXT.map, o, oi);
#define indirect_map_fetch(O) indirect_map_fetch(aTHX_ (O))
dMY_CXT;
+ /* No need to check for MY_CXT.map != NULL because this code path is always
+ * guarded by indirect_hint(). */
+
return ptable_fetch(MY_CXT.map, o);
}
#define indirect_map_delete(O) indirect_map_delete(aTHX_ (O))
dMY_CXT;
- ptable_delete(MY_CXT.map, o);
+ if (MY_CXT.map)
+ ptable_delete(MY_CXT.map, o);
}
/* --- Check functions ----------------------------------------------------- */
goto done;
oop = lop->op_first;
} while (oop->op_type != OP_PUSHMARK);
- oop = OP_SIBLING(oop);
+ oop = OpSIBLING(oop);
mop = lop->op_last;
if (!oop)