summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-12-13 14:19:28 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-12-13 14:19:28 +0000
commite7ae6809ba5905bb2ce7c09e88c6e2bdb5c913af (patch)
treecc4b0bc31e5af4e0e6348a9c18f42da46b937b5a
parent503ec68fa54cd074101e4004bdfe3124adc2a0df (diff)
downloadperl-e7ae6809ba5905bb2ce7c09e88c6e2bdb5c913af.tar.gz
Unadorned numbers evil.
p4raw-id: //depot/perl@13672
-rw-r--r--pp.c8
-rw-r--r--regcomp.c2
-rw-r--r--regexec.c16
-rw-r--r--utf8.c10
-rw-r--r--utf8.h7
5 files changed, 24 insertions, 19 deletions
diff --git a/pp.c b/pp.c
index 2fd40daa1a..9237a8b219 100644
--- a/pp.c
+++ b/pp.c
@@ -3210,7 +3210,7 @@ PP(pp_ucfirst)
STRLEN slen;
if (DO_UTF8(sv)) {
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
STRLEN ulen;
STRLEN tculen;
@@ -3265,7 +3265,7 @@ PP(pp_lcfirst)
if (DO_UTF8(sv) && (s = (U8*)SvPV(sv, slen)) && slen && UTF8_IS_START(*s)) {
STRLEN ulen;
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
U8 *tend;
UV uv;
@@ -3322,7 +3322,7 @@ PP(pp_uc)
STRLEN ulen;
register U8 *d;
U8 *send;
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
s = (U8*)SvPV(sv,len);
if (!len) {
@@ -3389,7 +3389,7 @@ PP(pp_lc)
STRLEN ulen;
register U8 *d;
U8 *send;
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
s = (U8*)SvPV(sv,len);
if (!len) {
diff --git a/regcomp.c b/regcomp.c
index a0f32f8c8b..53d89479a5 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2988,7 +2988,7 @@ tryagain:
char *oldp, *s;
STRLEN numlen;
STRLEN ulen;
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
parse_start = RExC_parse - 1;
diff --git a/regexec.c b/regexec.c
index 4b073d2da4..35a0a6c2b0 100644
--- a/regexec.c
+++ b/regexec.c
@@ -932,8 +932,8 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta
ln = STR_LEN(c);
if (UTF) {
STRLEN ulen1, ulen2;
- U8 tmpbuf1[UTF8_MAXLEN*2+1];
- U8 tmpbuf2[UTF8_MAXLEN*2+1];
+ U8 tmpbuf1[UTF8_MAXLEN_UCLC+1];
+ U8 tmpbuf2[UTF8_MAXLEN_UCLC+1];
to_utf8_lower((U8*)m, tmpbuf1, &ulen1);
to_utf8_upper((U8*)m, tmpbuf2, &ulen2);
@@ -2285,7 +2285,7 @@ S_regmatch(pTHX_ regnode *prog)
char *l = locinput;
char *e;
STRLEN ulen;
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
e = s + ln;
while (s < e) {
if (l >= PL_regeol)
@@ -2558,8 +2558,8 @@ S_regmatch(pTHX_ regnode *prog)
*/
if (OP(scan) == REFF) {
STRLEN ulen1, ulen2;
- U8 tmpbuf1[UTF8_MAXLEN*2+1];
- U8 tmpbuf2[UTF8_MAXLEN*2+1];
+ U8 tmpbuf1[UTF8_MAXLEN_UCLC+1];
+ U8 tmpbuf2[UTF8_MAXLEN_UCLC+1];
while (s < e) {
if (l >= PL_regeol)
sayNO;
@@ -3364,8 +3364,8 @@ S_regmatch(pTHX_ regnode *prog)
else { /* UTF */
if (OP(text_node) == EXACTF || OP(text_node) == REFF) {
STRLEN ulen1, ulen2;
- U8 tmpbuf1[UTF8_MAXLEN*2+1];
- U8 tmpbuf2[UTF8_MAXLEN*2+1];
+ U8 tmpbuf1[UTF8_MAXLEN_UCLC+1];
+ U8 tmpbuf2[UTF8_MAXLEN_UCLC+1];
to_utf8_lower((U8*)s, tmpbuf1, &ulen1);
to_utf8_upper((U8*)s, tmpbuf2, &ulen2);
@@ -4110,7 +4110,7 @@ S_reginclass(pTHX_ register regnode *n, register U8* p, register bool do_utf8)
match = TRUE;
else if (flags & ANYOF_FOLD) {
STRLEN ulen;
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
toLOWER_utf8(p, tmpbuf, &ulen);
if (swash_fetch(sw, tmpbuf, do_utf8))
diff --git a/utf8.c b/utf8.c
index 747b78cfe6..3a8c13a193 100644
--- a/utf8.c
+++ b/utf8.c
@@ -903,7 +903,7 @@ Perl_is_uni_punct(pTHX_ UV c)
bool
Perl_is_uni_xdigit(pTHX_ UV c)
{
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
uvchr_to_utf8(tmpbuf, (UV)c);
return is_utf8_xdigit(tmpbuf);
}
@@ -911,7 +911,7 @@ Perl_is_uni_xdigit(pTHX_ UV c)
UV
Perl_to_uni_upper(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
uvchr_to_utf8(tmpbuf, (UV)c);
return to_utf8_upper(tmpbuf, p, lenp);
}
@@ -919,7 +919,7 @@ Perl_to_uni_upper(pTHX_ UV c, U8* p, STRLEN *lenp)
UV
Perl_to_uni_title(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN*2+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
uvchr_to_utf8(tmpbuf, (UV)c);
return to_utf8_title(tmpbuf, p, lenp);
}
@@ -1596,8 +1596,8 @@ Perl_ibcmp_utf8(pTHX_ const char *s1, bool u1, register I32 len1, const char *s2
STRLEN la, lb;
UV ca, cb;
STRLEN ulen1, ulen2;
- U8 tmpbuf1[UTF8_MAXLEN*3+1];
- U8 tmpbuf2[UTF8_MAXLEN*3+1];
+ U8 tmpbuf1[UTF8_MAXLEN_FOLD+1];
+ U8 tmpbuf2[UTF8_MAXLEN_FOLD+1];
while (a < ae && b < be) {
if (u1) {
diff --git a/utf8.h b/utf8.h
index 01c6199f93..1c2243e2da 100644
--- a/utf8.h
+++ b/utf8.h
@@ -135,7 +135,12 @@ END_EXTERN_C
#define isIDFIRST_lazy(p) isIDFIRST_lazy_if(p,1)
#define isALNUM_lazy(p) isALNUM_lazy_if(p,1)
-#define UTF8_MAXLEN 13 /* how wide can a single UTF8 encoded character become */
+/* 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)
+/* how wide a character can become when casefolded */
+#define UTF8_MAXLEN_FOLD (UTF8_MAXLEN*3)
#define IN_BYTES (PL_curcop->op_private & HINT_BYTES)
#define DO_UTF8(sv) (SvUTF8(sv) && !IN_BYTES)