diff options
Diffstat (limited to 'op.h')
-rw-r--r-- | op.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -330,10 +330,20 @@ struct pmop { #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) |