summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-02-19 04:44:41 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-02-19 04:44:41 +0000
commit98b27f730135d66291d417127f64dc5e94d47ae3 (patch)
treece62c2a03ef833c6ea5bb451d95c25eb5dcc8f0c /pp.c
parentbbee22da22fa5dec68cc0a214906c852df8ebcc0 (diff)
downloadperl-98b27f730135d66291d417127f64dc5e94d47ae3.tar.gz
Let's not overdo the growth.
p4raw-id: //depot/perl@14764
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index be6d7233a2..f856ea6612 100644
--- a/pp.c
+++ b/pp.c
@@ -3350,8 +3350,10 @@ PP(pp_uc)
SETs(TARG);
}
else {
+ STRLEN nchar = utf8_length(s, s + len);
+
(void)SvUPGRADE(TARG, SVt_PV);
- SvGROW(TARG, (len * UTF8_MAXLEN_UCLC) + 1);
+ SvGROW(TARG, (nchar * UTF8_MAXLEN_UCLC) + 1);
(void)SvPOK_only(TARG);
d = (U8*)SvPVX(TARG);
send = s + len;
@@ -3417,8 +3419,10 @@ PP(pp_lc)
SETs(TARG);
}
else {
+ STRLEN nchar = utf8_length(s, s + len);
+
(void)SvUPGRADE(TARG, SVt_PV);
- SvGROW(TARG, (len * UTF8_MAXLEN_UCLC) + 1);
+ SvGROW(TARG, (nchar * UTF8_MAXLEN_UCLC) + 1);
(void)SvPOK_only(TARG);
d = (U8*)SvPVX(TARG);
send = s + len;