summaryrefslogtreecommitdiff
path: root/mg.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 /mg.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 'mg.c')
-rw-r--r--mg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mg.c b/mg.c
index 3f51a1744e..cc01547570 100644
--- a/mg.c
+++ b/mg.c
@@ -2015,7 +2015,7 @@ Perl_magic_getsubstr(pTHX_ SV *sv, MAGIC *mg)
PERL_UNUSED_ARG(mg);
if (SvUTF8(lsv))
- sv_pos_u2b_proper(lsv, &offs, &rem);
+ offs = sv_pos_u2b_flags(lsv, offs, &rem, SV_CONST_RETURN);
if (offs > len)
offs = len;
if (rem > len - offs)
@@ -2041,14 +2041,14 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
if (DO_UTF8(sv)) {
sv_utf8_upgrade(lsv);
- sv_pos_u2b_proper(lsv, &lvoff, &lvlen);
+ lvoff = sv_pos_u2b_flags(lsv, lvoff, &lvlen, SV_CONST_RETURN);
sv_insert(lsv, lvoff, lvlen, tmps, len);
LvTARGLEN(sv) = sv_len_utf8(sv);
SvUTF8_on(lsv);
}
else if (lsv && SvUTF8(lsv)) {
const char *utf8;
- sv_pos_u2b_proper(lsv, &lvoff, &lvlen);
+ lvoff = sv_pos_u2b_flags(lsv, lvoff, &lvlen, SV_CONST_RETURN);
LvTARGLEN(sv) = len;
utf8 = (char*)bytes_to_utf8((U8*)tmps, &len);
sv_insert(lsv, lvoff, lvlen, utf8, len);