Diff for /embedaddon/pcre/pcre_maketables.c between versions 1.1.1.1 and 1.1.1.4

version 1.1.1.1, 2012/02/21 23:05:51 version 1.1.1.4, 2014/06/15 19:46:04
Line 6 Line 6
 and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
   
                        Written by Philip Hazel                         Written by Philip Hazel
           Copyright (c) 1997-2008 University of Cambridge           Copyright (c) 1997-2012 University of Cambridge
   
 -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 59  compilation of dftables.c, in which case the macro DFT Line 59  compilation of dftables.c, in which case the macro DFT
 /* This function builds a set of character tables for use by PCRE and returns  /* This function builds a set of character tables for use by PCRE and returns
 a pointer to them. They are build using the ctype functions, and consequently  a pointer to them. They are build using the ctype functions, and consequently
 their contents will depend upon the current locale setting. When compiled as  their contents will depend upon the current locale setting. When compiled as
part of the library, the store is obtained via pcre_malloc(), but when compiledpart of the library, the store is obtained via PUBL(malloc)(), but when
inside dftables, use malloc().compiled inside dftables, use malloc().
   
 Arguments:   none  Arguments:   none
 Returns:     pointer to the contiguous block of data  Returns:     pointer to the contiguous block of data
 */  */
   
   #if defined COMPILE_PCRE8
 const unsigned char *  const unsigned char *
 pcre_maketables(void)  pcre_maketables(void)
   #elif defined COMPILE_PCRE16
   const unsigned char *
   pcre16_maketables(void)
   #elif defined COMPILE_PCRE32
   const unsigned char *
   pcre32_maketables(void)
   #endif
 {  {
 unsigned char *yield, *p;  unsigned char *yield, *p;
 int i;  int i;
   
 #ifndef DFTABLES  #ifndef DFTABLES
yield = (unsigned char*)(pcre_malloc)(tables_length);yield = (unsigned char*)(PUBL(malloc))(tables_length);
 #else  #else
 yield = (unsigned char*)malloc(tables_length);  yield = (unsigned char*)malloc(tables_length);
 #endif  #endif
Line 90  for (i = 0; i < 256; i++) *p++ = tolower(i); Line 98  for (i = 0; i < 256; i++) *p++ = tolower(i);
 for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : 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  /* 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 tableexclusive ones - in some locales things may be different.
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. */ 
   
   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:].
   From release 8.34 is is also correct for Perl space, because Perl added VT at
   release 5.18.
   
   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);  memset(p, 0, cbit_length);
 for (i = 0; i < 256; i++)  for (i = 0; i < 256; i++)
   {    {
Line 115  for (i = 0; i < 256; i++) Line 127  for (i = 0; i < 256; i++)
   }    }
 p += cbit_length;  p += cbit_length;
   
/* Finally, the character type table. In this, we exclude VT from the white/* Finally, the character type table. In this, we used to exclude VT from the
space chars, because Perl doesn't recognize it as such for \s and for commentswhite space chars, because Perl didn't recognize it as such for \s and for
within regexes. */comments within regexes. However, Perl changed at release 5.18, so PCRE changed
 at release 8.34. */
   
 for (i = 0; i < 256; i++)  for (i = 0; i < 256; i++)
   {    {
   int x = 0;    int x = 0;
  if (i != 0x0b && isspace(i)) x += ctype_space;  if (isspace(i)) x += ctype_space;
   if (isalpha(i)) x += ctype_letter;    if (isalpha(i)) x += ctype_letter;
   if (isdigit(i)) x += ctype_digit;    if (isdigit(i)) x += ctype_digit;
   if (isxdigit(i)) x += ctype_xdigit;    if (isxdigit(i)) x += ctype_xdigit;

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>