From: Father Chrysostomos Date: Fri, 31 Aug 2012 06:06:14 +0000 (-0700) Subject: Stop calling get-magic twice in pack "u", $utf8 X-Git-Tag: upstream/5.20.0~5538 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f63b0e5ad2a410fc3056eabf43c29c1d622000e;p=platform%2Fupstream%2Fperl.git Stop calling get-magic twice in pack "u", $utf8 --- diff --git a/pp_pack.c b/pp_pack.c index c9d9fcb..c760f69 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -3569,7 +3569,7 @@ extern const double _double_constants[]; from_utf8 = DO_UTF8(fromstr); if (from_utf8) { aend = aptr + fromlen; - fromlen = sv_len_utf8(fromstr); + fromlen = sv_len_utf8_nomg(fromstr); } else aend = NULL; /* Unused, but keep compilers happy */ GROWING(utf8, cat, start, cur, (fromlen+2) / 3 * 4 + (fromlen+len-1)/len * 2); while (fromlen > 0) { diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t index 48a070b..7ad375a 100644 --- a/t/op/tie_fetch_count.t +++ b/t/op/tie_fetch_count.t @@ -7,7 +7,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - plan (tests => 307); + plan (tests => 308); } use strict; @@ -248,6 +248,10 @@ for ([chdir=>''],[chmod=>'0,'],[chown=>'0,0,'],[utime=>'0,0,'], ; check_count 'select $tied_undef, ...'; } +chop(my $u = "\xff\x{100}"); +tie $var, "main", $u; +$dummy = pack "u", $var; check_count 'pack "u", $utf8'; + tie $var, "main", "\x{100}"; pos$var = 0 ; check_count 'lvalue pos $utf8'; $dummy = substr$var,0,1; check_count 'substr $utf8';