/[pcre]/code/trunk/pcre_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_compile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 240 by ph10, Tue Sep 11 15:47:20 2007 UTC revision 243 by ph10, Thu Sep 13 09:28:14 2007 UTC
# Line 140  static const short int escapes[] = { Line 140  static const short int escapes[] = {
140  #endif  #endif
141    
142    
143  /* Table of special "verbs" like (*PRUNE). This is a short table, so it is  /* Table of special "verbs" like (*PRUNE). This is a short table, so it is
144  searched linearly. Put all the names into a single string, in order to reduce  searched linearly. Put all the names into a single string, in order to reduce
145  the number of relocations when a shared library is dynamically linked. */  the number of relocations when a shared library is dynamically linked. */
146    
147  typedef struct verbitem {  typedef struct verbitem {
# Line 150  typedef struct verbitem { Line 150  typedef struct verbitem {
150  } verbitem;  } verbitem;
151    
152  static const char verbnames[] =  static const char verbnames[] =
153    "ACCEPT\0"    "ACCEPT\0"
154    "COMMIT\0"    "COMMIT\0"
155    "F\0"    "F\0"
156    "FAIL\0"    "FAIL\0"
157    "PRUNE\0"    "PRUNE\0"
158    "SKIP\0"    "SKIP\0"
159    "THEN";    "THEN";
160    
161  static verbitem verbs[] = {  static verbitem verbs[] = {
162    { 6, OP_ACCEPT },    { 6, OP_ACCEPT },
# Line 171  static verbitem verbs[] = { Line 171  static verbitem verbs[] = {
171  static int verbcount = sizeof(verbs)/sizeof(verbitem);  static int verbcount = sizeof(verbs)/sizeof(verbitem);
172    
173    
174  /* Tables of names of POSIX character classes and their lengths. The names are  /* Tables of names of POSIX character classes and their lengths. The names are
175  now all in a single string, to reduce the number of relocations when a shared  now all in a single string, to reduce the number of relocations when a shared
176  library is dynamically loaded. The list of lengths is terminated by a zero  library is dynamically loaded. The list of lengths is terminated by a zero
177  length entry. The first three must be alpha, lower, upper, as this is assumed  length entry. The first three must be alpha, lower, upper, as this is assumed
178  for handling case independence. */  for handling case independence. */
179    
180  static const char posix_names[] =  static const char posix_names[] =
181    "alpha\0"  "lower\0"  "upper\0"  "alnum\0"  "ascii\0"  "blank\0"    "alpha\0"  "lower\0"  "upper\0"  "alnum\0"  "ascii\0"  "blank\0"
182    "cntrl\0"  "digit\0"  "graph\0"  "print\0"  "punct\0"  "space\0"    "cntrl\0"  "digit\0"  "graph\0"  "print\0"  "punct\0"  "space\0"
183    "word\0"   "xdigit";    "word\0"   "xdigit";
184    
185  static const uschar posix_name_lengths[] = {  static const uschar posix_name_lengths[] = {
# Line 219  static const int posix_class_maps[] = { Line 219  static const int posix_class_maps[] = {
219  /* The texts of compile-time error messages. These are "char *" because they  /* The texts of compile-time error messages. These are "char *" because they
220  are passed to the outside world. Do not ever re-use any error number, because  are passed to the outside world. Do not ever re-use any error number, because
221  they are documented. Always add a new error instead. Messages marked DEAD below  they are documented. Always add a new error instead. Messages marked DEAD below
222  are no longer used. This used to be a table of strings, but in order to reduce  are no longer used. This used to be a table of strings, but in order to reduce
223  the number of relocations needed when a shared library is loaded dynamically,  the number of relocations needed when a shared library is loaded dynamically,
224  it is now one long string. We cannot use a table of offsets, because the  it is now one long string. We cannot use a table of offsets, because the
225  lengths of inserts such as XSTRING(MAX_NAME_SIZE) are not known. Instead, we  lengths of inserts such as XSTRING(MAX_NAME_SIZE) are not known. Instead, we
226  simply count through to the one we want - this isn't a performance issue  simply count through to the one we want - this isn't a performance issue
227  because these strings are used only when there is a compilation error. */  because these strings are used only when there is a compilation error. */
228    
229  static const char error_texts[] =  static const char error_texts[] =
# Line 439  static BOOL Line 439  static BOOL
439  *            Find an error text                  *  *            Find an error text                  *
440  *************************************************/  *************************************************/
441    
442  /* The error texts are now all in one long string, to save on relocations. As  /* The error texts are now all in one long string, to save on relocations. As
443  some of the text is of unknown length, we can't use a table of offsets.  some of the text is of unknown length, we can't use a table of offsets.
444  Instead, just count through the strings. This is not a performance issue  Instead, just count through the strings. This is not a performance issue
445  because it happens only when there has been a compilation error.  because it happens only when there has been a compilation error.
446    
447  Argument:   the error number  Argument:   the error number
# Line 452  static const char * Line 452  static const char *
452  find_error_text(int n)  find_error_text(int n)
453  {  {
454  const char *s = error_texts;  const char *s = error_texts;
455  for (; n > 0; n--) while (*s++ != 0);  for (; n > 0; n--) while (*s++ != 0);
456  return s;  return s;
457  }  }
458    
# Line 1777  while (posix_name_lengths[yield] != 0) Line 1777  while (posix_name_lengths[yield] != 0)
1777    {    {
1778    if (len == posix_name_lengths[yield] &&    if (len == posix_name_lengths[yield] &&
1779      strncmp((const char *)ptr, pn, len) == 0) return yield;      strncmp((const char *)ptr, pn, len) == 0) return yield;
1780    pn += posix_name_lengths[yield] + 1;    pn += posix_name_lengths[yield] + 1;
1781    yield++;    yield++;
1782    }    }
1783  return -1;  return -1;
# Line 4064  we set the flag only if there is a liter Line 4064  we set the flag only if there is a liter
4064      if (*(++ptr) == '*' && (cd->ctypes[ptr[1]] & ctype_letter) != 0)      if (*(++ptr) == '*' && (cd->ctypes[ptr[1]] & ctype_letter) != 0)
4065        {        {
4066        int i, namelen;        int i, namelen;
4067        const char *vn = verbnames;        const char *vn = verbnames;
4068        const uschar *name = ++ptr;        const uschar *name = ++ptr;
4069        previous = NULL;        previous = NULL;
4070        while ((cd->ctypes[*++ptr] & ctype_letter) != 0);        while ((cd->ctypes[*++ptr] & ctype_letter) != 0);
# Line 4088  we set the flag only if there is a liter Line 4088  we set the flag only if there is a liter
4088            if (*code++ == OP_ACCEPT) cd->had_accept = TRUE;            if (*code++ == OP_ACCEPT) cd->had_accept = TRUE;
4089            break;            break;
4090            }            }
4091          vn += verbs[i].len + 1;          vn += verbs[i].len + 1;
4092          }          }
4093        if (i < verbcount) continue;        if (i < verbcount) continue;
4094        *errorcodeptr = ERR60;        *errorcodeptr = ERR60;

Legend:
Removed from v.240  
changed lines
  Added in v.243

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12