Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/B/B.xs
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion invlist_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
12 changes: 10 additions & 2 deletions op.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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
Expand Down