From: Jarkko Hietaniemi Date: Tue, 19 Feb 2002 04:44:41 +0000 (+0000) Subject: Let's not overdo the growth. X-Git-Tag: accepted/trunk/20130322.191538~28003 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98b27f730135d66291d417127f64dc5e94d47ae3;p=platform%2Fupstream%2Fperl.git Let's not overdo the growth. p4raw-id: //depot/perl@14764 --- diff --git a/pp.c b/pp.c index be6d723..f856ea6 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;