X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/4fbcfc2ed4b301bc25f45931b0639eace3411cff..aa41d2de89da4bf43d52fd12a191742ff9b668a0:/src/src/pcre/pcre_maketables.c diff --git a/src/src/pcre/pcre_maketables.c b/src/src/pcre/pcre_maketables.c index d686383ac..3f6ec8415 100644 --- a/src/src/pcre/pcre_maketables.c +++ b/src/src/pcre/pcre_maketables.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/pcre/pcre_maketables.c,v 1.2 2005/08/08 10:22:14 ph10 Exp $ */ +/* $Cambridge: exim/src/src/pcre/pcre_maketables.c,v 1.3 2006/11/07 16:50:36 ph10 Exp $ */ /************************************************* * Perl-Compatible Regular Expressions * @@ -8,7 +8,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel - Copyright (c) 1997-2005 University of Cambridge + Copyright (c) 1997-2006 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -88,29 +88,22 @@ for (i = 0; i < 256; i++) *p++ = tolower(i); for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i); -/* Then the character class tables. Don't try to be clever and save effort -on exclusive ones - in some locales things may be different. Note that the -table for "space" includes everything "isspace" gives, including VT in the -default locale. This makes it work for the POSIX class [:space:]. */ +/* Then the character class tables. Don't try to be clever and save effort on +exclusive ones - in some locales things may be different. Note that the table +for "space" includes everything "isspace" gives, including VT in the default +locale. This makes it work for the POSIX class [:space:]. Note also that it is +possible for a character to be alnum or alpha without being lower or upper, +such as "male and female ordinals" (\xAA and \xBA) in the fr_FR locale (at +least under Debian Linux's locales as of 12/2005). So we must test for alnum +specially. */ memset(p, 0, cbit_length); for (i = 0; i < 256; i++) { - if (isdigit(i)) - { - p[cbit_digit + i/8] |= 1 << (i&7); - p[cbit_word + i/8] |= 1 << (i&7); - } - if (isupper(i)) - { - p[cbit_upper + i/8] |= 1 << (i&7); - p[cbit_word + i/8] |= 1 << (i&7); - } - if (islower(i)) - { - p[cbit_lower + i/8] |= 1 << (i&7); - p[cbit_word + i/8] |= 1 << (i&7); - } + if (isdigit(i)) p[cbit_digit + i/8] |= 1 << (i&7); + if (isupper(i)) p[cbit_upper + i/8] |= 1 << (i&7); + if (islower(i)) p[cbit_lower + i/8] |= 1 << (i&7); + if (isalnum(i)) p[cbit_word + i/8] |= 1 << (i&7); if (i == '_') p[cbit_word + i/8] |= 1 << (i&7); if (isspace(i)) p[cbit_space + i/8] |= 1 << (i&7); if (isxdigit(i))p[cbit_xdigit + i/8] |= 1 << (i&7); @@ -139,7 +132,9 @@ for (i = 0; i < 256; i++) meta-character, which in this sense is any character that terminates a run of data characters. */ - if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta; *p++ = x; } + if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta; + *p++ = x; + } return yield; }