Stop calling get-magic twice in sprintf "%1s", $utf8
authorFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 06:19:56 +0000 (23:19 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 06:19:56 +0000 (23:19 -0700)
sv.c
t/op/tie_fetch_count.t

diff --git a/sv.c b/sv.c
index 09128ec..fa0fb23 100644 (file)
--- 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;
                }
index 7ad375a..50671d9 100644 (file)
@@ -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)';