av_push((AV*) PL_regex_pad[0],(SV*) PL_regex_pad[(cPMOPo)->op_pmoffset]);
SvREADONLY_off(PL_regex_pad[(cPMOPo)->op_pmoffset]);
SvREPADTMP_on(PL_regex_pad[(cPMOPo)->op_pmoffset]);
- PM_SETRE(cPMOPo, (cPMOPo)->op_pmoffset);
+ PM_SETRE_OFFSET(cPMOPo, (cPMOPo)->op_pmoffset);
}
#else
ReREFCNT_dec(PM_GETRE(cPMOPo));
#ifdef USE_ITHREADS
#define PM_GETRE(o) (INT2PTR(REGEXP*,SvIVX(PL_regex_pad[(o)->op_pmoffset])))
-#define PM_SETRE(o,r) STMT_START { \
+/* The assignment is just to enforce type safety (or at least get a warning).
+ */
+#define PM_SETRE(o,r) STMT_START { \
+ const REGEXP *const slosh = (r); \
+ PM_SETRE_OFFSET((o), PTR2IV(slosh)); \
+ } STMT_END
+/* Actually you can assign any IV, not just an offset. And really should it be
+ UV? */
+#define PM_SETRE_OFFSET(o,iv) \
+ STMT_START { \
SV* const sv = PL_regex_pad[(o)->op_pmoffset]; \
- sv_setiv(sv, PTR2IV(r)); \
+ sv_setiv(sv, (iv)); \
} STMT_END
+
# ifndef PERL_CORE
/* No longer used anywhere in the core. Migrate to Devel::PPPort? */
#define PM_GETRE_SAFE(o) (PL_regex_pad ? PM_GETRE(o) : (REGEXP*)0)