summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-01-29 10:41:14 -0700
committerKarl Williamson <public@khwilliamson.com>2012-01-29 13:58:12 -0700
commitea4d335b445aa246c7b9e4d60a6983bb23108fc0 (patch)
treebbbcd2755c44a11a758852e95f920bd6d6923e0f
parent628253b8ba8b9cbebcf85ac3826fb6d8fdeb166a (diff)
downloadperl-ea4d335b445aa246c7b9e4d60a6983bb23108fc0.tar.gz
pp.c: Can grow scalar by less
The max expansion when a Latin1 character is folded and converted to UTF-8 is '2' bytes per input byte, not the more general case.
-rw-r--r--pp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 1dc04608e4..29ed4c672e 100644
--- a/pp.c
+++ b/pp.c
@@ -4218,7 +4218,9 @@ PP(pp_fc)
SvCUR_set(dest, len);
len = sv_utf8_upgrade_flags_grow(dest,
SV_GMAGIC|SV_FORCE_UTF8_UPGRADE,
- (send -s) * UTF8_MAX_FOLD_CHAR_EXPAND + 1);
+ /* The max expansion for latin1
+ * chars is 1 byte becomes 2 */
+ (send -s) * 2 + 1);
d = (U8*)SvPVX(dest) + len;
CAT_UNI_TO_UTF8_TWO_BYTE(d, GREEK_SMALL_LETTER_MU);