From: Jarkko Hietaniemi Date: Tue, 19 Feb 2002 01:55:14 +0000 (+0000) Subject: Not extending enough. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3ec562b0bffb8b8b48df56ef7460b59729c19345;p=p5sagit%2Fp5-mst-13.2.git Not extending enough. p4raw-id: //depot/perl@14758 --- diff --git a/pp.c b/pp.c index 51facc0..be6d723 100644 --- a/pp.c +++ b/pp.c @@ -3351,7 +3351,7 @@ PP(pp_uc) } else { (void)SvUPGRADE(TARG, SVt_PV); - SvGROW(TARG, (len * 2) + 1); + SvGROW(TARG, (len * UTF8_MAXLEN_UCLC) + 1); (void)SvPOK_only(TARG); d = (U8*)SvPVX(TARG); send = s + len; @@ -3418,7 +3418,7 @@ PP(pp_lc) } else { (void)SvUPGRADE(TARG, SVt_PV); - SvGROW(TARG, (len * 2) + 1); + SvGROW(TARG, (len * UTF8_MAXLEN_UCLC) + 1); (void)SvPOK_only(TARG); d = (U8*)SvPVX(TARG); send = s + len; diff --git a/utf8.h b/utf8.h index 49531a9..feff1b4 100644 --- a/utf8.h +++ b/utf8.h @@ -138,9 +138,11 @@ END_EXTERN_C /* how wide can a single UTF8 encoded character become */ #define UTF8_MAXLEN 13 /* how wide a character can become when upper/lowercased */ -#define UTF8_MAXLEN_UCLC (UTF8_MAXLEN*2) +#define UTF8_MAXLEN_UCLC_MULT 3 +#define UTF8_MAXLEN_UCLC (UTF8_MAXLEN*UTF8_MAXLEN_UCLC_MULT) /* how wide a character can become when casefolded */ -#define UTF8_MAXLEN_FOLD (UTF8_MAXLEN*3) +#define UTF8_MAXLEN_FOLD_MULT 3 +#define UTF8_MAXLEN_FOLD (UTF8_MAXLEN*UTF8_MAXLEN_FOLD_MULT) #define IN_BYTES (PL_curcop->op_private & HINT_BYTES) #define DO_UTF8(sv) (SvUTF8(sv) && !IN_BYTES)