summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-10-01 09:08:18 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-10-01 12:51:58 -0700
commit667f6f1513bb7f13b7b6bb7c1acaeed6f8f9c6dd (patch)
tree8afb9260c5826e09e95d72dce440d04a48d67f71 /sv.c
parent6715405f56348468cfa2fd83507da0171e7aed58 (diff)
downloadperl-667f6f1513bb7f13b7b6bb7c1acaeed6f8f9c6dd.tar.gz
Make sprintf "%1s" and "%.1s" call overloading once
Calling overloading multiple times can probably result in mangled UTF8, but it is much easier just to test for the number of calls.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sv.c b/sv.c
index c446fbaa41..774154c66e 100644
--- a/sv.c
+++ b/sv.c
@@ -10532,16 +10532,17 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
if (DO_UTF8(argsv)) {
STRLEN old_precis = precis;
if (has_precis && precis < elen) {
- STRLEN ulen = sv_len_utf8_nomg(argsv);
+ STRLEN ulen = sv_or_pv_len_utf8(argsv, eptr, elen);
STRLEN p = precis > ulen ? ulen : precis;
- precis = sv_pos_u2b_flags(argsv, p, 0, 0);
+ precis = sv_or_pv_pos_u2b(argsv, eptr, p, 0);
/* sticks at end */
}
if (width) { /* fudge width (can't fudge elen) */
if (has_precis && precis < elen)
width += precis - old_precis;
else
- width += elen - sv_len_utf8_nomg(argsv);
+ width +=
+ elen - sv_or_pv_len_utf8(argsv,eptr,elen);
}
is_utf8 = TRUE;
}