diff options
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 39 |
1 files changed, 10 insertions, 29 deletions
@@ -3312,9 +3312,7 @@ PP(pp_index) Otherwise I need to avoid calls to sv_pos_u2b(), which (dangerously) will trigger magic and overloading again, as will fbm_instr() */ - big = sv_2mortal(newSVpvn(big_p, biglen)); - if (big_utf8) - SvUTF8_on(big); + big = sv_2mortal(newSVpvn_utf8(big_p, biglen, big_utf8)); big_p = SvPVX(big); } if (SvGAMAGIC(little) || (is_index && !SvOK(little))) { @@ -3326,9 +3324,7 @@ PP(pp_index) This is all getting to messy. The API isn't quite clean enough, because data access has side effects. */ - little = sv_2mortal(newSVpvn(little_p, llen)); - if (little_utf8) - SvUTF8_on(little); + little = sv_2mortal(newSVpvn_utf8(little_p, llen, little_utf8)); little_p = SvPVX(little); } @@ -4755,11 +4751,9 @@ PP(pp_split) if (m >= strend) break; - dstr = newSVpvn(s, m-s); + dstr = newSVpvn_utf8(s, m-s, do_utf8); if (make_mortal) sv_2mortal(dstr); - if (do_utf8) - (void)SvUTF8_on(dstr); XPUSHs(dstr); /* skip the whitespace found last */ @@ -4788,11 +4782,9 @@ PP(pp_split) m++; if (m >= strend) break; - dstr = newSVpvn(s, m-s); + dstr = newSVpvn_utf8(s, m-s, do_utf8); if (make_mortal) sv_2mortal(dstr); - if (do_utf8) - (void)SvUTF8_on(dstr); XPUSHs(dstr); s = m; } @@ -4817,12 +4809,11 @@ PP(pp_split) /* keep track of how many bytes we skip over */ m = s; s += UTF8SKIP(s); - dstr = newSVpvn(m, s-m); + dstr = newSVpvn_utf8(m, s-m, TRUE); if (make_mortal) sv_2mortal(dstr); - (void)SvUTF8_on(dstr); PUSHs(dstr); if (s >= strend) @@ -4859,11 +4850,9 @@ PP(pp_split) ; if (m >= strend) break; - dstr = newSVpvn(s, m-s); + dstr = newSVpvn_utf8(s, m-s, do_utf8); if (make_mortal) sv_2mortal(dstr); - if (do_utf8) - (void)SvUTF8_on(dstr); XPUSHs(dstr); /* The rx->minlen is in characters but we want to step * s ahead by bytes. */ @@ -4878,11 +4867,9 @@ PP(pp_split) (m = fbm_instr((unsigned char*)s, (unsigned char*)strend, csv, multiline ? FBMrf_MULTILINE : 0)) ) { - dstr = newSVpvn(s, m-s); + dstr = newSVpvn_utf8(s, m-s, do_utf8); if (make_mortal) sv_2mortal(dstr); - if (do_utf8) - (void)SvUTF8_on(dstr); XPUSHs(dstr); /* The rx->minlen is in characters but we want to step * s ahead by bytes. */ @@ -4913,11 +4900,9 @@ PP(pp_split) strend = s + (strend - m); } m = RX_OFFS(rx)[0].start + orig; - dstr = newSVpvn(s, m-s); + dstr = newSVpvn_utf8(s, m-s, do_utf8); if (make_mortal) sv_2mortal(dstr); - if (do_utf8) - (void)SvUTF8_on(dstr); XPUSHs(dstr); if (RX_NPARENS(rx)) { I32 i; @@ -4929,14 +4914,12 @@ PP(pp_split) parens that didn't match -- they should be set to undef, not the empty string */ if (m >= orig && s >= orig) { - dstr = newSVpvn(s, m-s); + dstr = newSVpvn_utf8(s, m-s, do_utf8); } else dstr = &PL_sv_undef; /* undef, not "" */ if (make_mortal) sv_2mortal(dstr); - if (do_utf8) - (void)SvUTF8_on(dstr); XPUSHs(dstr); } } @@ -4951,11 +4934,9 @@ PP(pp_split) /* keep field after final delim? */ if (s < strend || (iters && origlimit)) { const STRLEN l = strend - s; - dstr = newSVpvn(s, l); + dstr = newSVpvn_utf8(s, l, do_utf8); if (make_mortal) sv_2mortal(dstr); - if (do_utf8) - (void)SvUTF8_on(dstr); XPUSHs(dstr); iters++; } |