summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-03-26 21:05:20 +0000
committerNicholas Clark <nick@ccl4.org>2008-03-26 21:05:20 +0000
commitce47496284713207331ee4a6b164a0088c7e4776 (patch)
tree64a2f7946f5e84ec16aba673f8b5e9af2435d342 /pp_ctl.c
parentefcbbafbf10077e558f8e3e69fc9ffdd50d0924f (diff)
downloadperl-ce47496284713207331ee4a6b164a0088c7e4776.tar.gz
The offset for pos is stored as bytes, and converted to (Unicode)
character position when read, if needed. The code for setting pos inside subst was incorrectly converting to character position before storing the value. This code appears to have been buggy since it was added in 2000 in change 7562. p4raw-id: //depot/perl@33580
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 0b4da4dfef..a3be377c1b 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -298,7 +298,6 @@ PP(pp_substcont)
{ /* Update the pos() information. */
SV * const sv = cx->sb_targ;
MAGIC *mg;
- I32 i;
SvUPGRADE(sv, SVt_PVMG);
if (!(mg = mg_find(sv, PERL_MAGIC_regex_global))) {
#ifdef PERL_OLD_COPY_ON_WRITE
@@ -308,10 +307,7 @@ PP(pp_substcont)
mg = sv_magicext(sv, NULL, PERL_MAGIC_regex_global, &PL_vtbl_mglob,
NULL, 0);
}
- i = m - orig;
- if (DO_UTF8(sv))
- sv_pos_b2u(sv, &i);
- mg->mg_len = i;
+ mg->mg_len = m - orig;
}
if (old != rx)
(void)ReREFCNT_inc(rx);