summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-02-14 12:31:44 +0000
committerNicholas Clark <nick@ccl4.org>2010-02-14 16:32:51 +0000
commitd931b1bedc59d4625c59047dfda2b1bd83ff9f71 (patch)
treeb6df8c2182b2f94b636bf68a400342316d8039bb /pp.c
parent1c90055717b05b3f652bf543a46419001314c53e (diff)
downloadperl-d931b1bedc59d4625c59047dfda2b1bd83ff9f71.tar.gz
Convert Perl_sv_pos_u2b_proper() to Perl_sv_pos_u2b_flags().
Change from a value/return offset pointer to passing a Unicode offset, and returning a byte offset. The optional length value/return pointer remains. Add a flags argument, passed to SvPV_flags(). This allows the caller to specify whether mg_get() should be called on sv.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pp.c b/pp.c
index 8f01e85621..3e2ed48854 100644
--- a/pp.c
+++ b/pp.c
@@ -3204,10 +3204,10 @@ PP(pp_substr)
/* pos1_iv and pos2_iv both in 0..curlen, so the cast is safe */
const STRLEN pos = (STRLEN)( (UV)pos1_iv );
const STRLEN len = (STRLEN)( (UV)pos2_iv - (UV)pos1_iv );
- STRLEN byte_pos = pos;
STRLEN byte_len = len;
- if (utf8_curlen)
- sv_pos_u2b_proper(sv, &byte_pos, &byte_len);
+ STRLEN byte_pos = utf8_curlen
+ ? sv_pos_u2b_flags(sv, pos, &byte_len, SV_CONST_RETURN) : pos;
+
tmps += byte_pos;
/* we either return a PV or an LV. If the TARG hasn't been used
* before, or is of that type, reuse it; otherwise use a mortal