diff --git a/ext/B/B.xs b/ext/B/B.xs index e6e3fb830968..e89118502679 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -10,6 +10,7 @@ #define PERL_NO_GET_CONTEXT #define PERL_EXT #include "EXTERN.h" +#define PERL_IN_B_XS #include "perl.h" #include "XSUB.h" diff --git a/invlist_inline.h b/invlist_inline.h index f6ac81953355..1aec16a89a8a 100644 --- a/invlist_inline.h +++ b/invlist_inline.h @@ -15,7 +15,8 @@ || defined(PERL_IN_TOKE_C) \ || defined(PERL_IN_PP_C) \ || defined(PERL_IN_OP_C) \ - || defined(PERL_IN_DOOP_C) + || defined(PERL_IN_DOOP_C) \ + || defined(PERL_IN_B_XS) /* An element is in an inversion list iff its index is even numbered: 0, 2, 4, * etc */ diff --git a/op.c b/op.c index 421387ed107b..8ea2e053653e 100644 --- a/op.c +++ b/op.c @@ -7909,6 +7909,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) || r_map[len-1] == TR_SPECIAL_HANDLING)))) { SV* r_map_sv; + SV* temp_sv; /* A UTF-8 op is generated, indicated by this flag. This op is an * sv_op */ @@ -7920,19 +7921,26 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) /* The inversion map is pushed; first the list. */ invmap = MUTABLE_AV(newAV()); + + SvREADONLY_on(t_invlist); av_push(invmap, t_invlist); /* 2nd is the mapping */ r_map_sv = newSVpvn((char *) r_map, len * sizeof(UV)); + SvREADONLY_on(r_map_sv); av_push(invmap, r_map_sv); /* 3rd is the max possible expansion factor */ - av_push(invmap, newSVnv(max_expansion)); + temp_sv = newSVnv(max_expansion); + SvREADONLY_on(temp_sv); + av_push(invmap, temp_sv); /* Characters that are in the search list, but not in the replacement * list are mapped to the final character in the replacement list */ if (! del && r_count < t_count) { - av_push(invmap, newSVuv(final_map)); + temp_sv = newSVuv(final_map); + SvREADONLY_on(temp_sv); + av_push(invmap, temp_sv); } #ifdef USE_ITHREADS