From 4b8b6103c4d041af2ce5cad075f069009e5c91b3 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 30 Aug 2012 23:19:56 -0700 Subject: [PATCH] Stop calling get-magic twice in sprintf "%1s", $utf8 --- sv.c | 2 +- t/op/tie_fetch_count.t | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sv.c b/sv.c index 09128ec..fa0fb23 100644 --- a/sv.c +++ b/sv.c @@ -10526,7 +10526,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p if (has_precis && precis < elen) width += precis - old_precis; else - width += elen - sv_len_utf8(argsv); + width += elen - sv_len_utf8_nomg(argsv); } is_utf8 = TRUE; } diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t index 7ad375a..50671d9 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 => 308); + plan (tests => 309); } use strict; @@ -254,6 +254,7 @@ $dummy = pack "u", $var; check_count 'pack "u", $utf8'; tie $var, "main", "\x{100}"; pos$var = 0 ; check_count 'lvalue pos $utf8'; +$dummy=sprintf"%1s",$var; check_count 'sprintf "%1s", $utf8'; $dummy = substr$var,0,1; check_count 'substr $utf8'; my $l =\substr$var,0,1; $dummy = $$l ; check_count 'reading lvalue substr($utf8)'; -- 2.7.4