/[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 849 by ph10, Wed Jan 4 17:02:01 2012 UTC revision 903 by ph10, Sat Jan 21 16:37:17 2012 UTC
# Line 488  static const char error_texts[] = Line 488  static const char error_texts[] =
488    "\\N is not supported in a class\0"    "\\N is not supported in a class\0"
489    "too many forward references\0"    "too many forward references\0"
490    "disallowed Unicode code point (>= 0xd800 && <= 0xdfff)\0"    "disallowed Unicode code point (>= 0xd800 && <= 0xdfff)\0"
491    "invalid UTF-16 string\0"    "invalid UTF-16 string\0"
492    ;    ;
493    
494  /* Table to identify digits and hex digits. This is used when compiling  /* Table to identify digits and hex digits. This is used when compiling
# Line 998  else Line 998  else
998      c -= CHAR_0;      c -= CHAR_0;
999      while(i++ < 2 && ptr[1] >= CHAR_0 && ptr[1] <= CHAR_7)      while(i++ < 2 && ptr[1] >= CHAR_0 && ptr[1] <= CHAR_7)
1000          c = c * 8 + *(++ptr) - CHAR_0;          c = c * 8 + *(++ptr) - CHAR_0;
1001  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
1002      if (!utf && c > 0xff) *errorcodeptr = ERR51;      if (!utf && c > 0xff) *errorcodeptr = ERR51;
1003  #endif  #endif
1004      break;      break;
1005    
1006      /* \x is complicated. \x{ddd} is a character number which can be greater      /* \x is complicated. \x{ddd} is a character number which can be greater
# Line 7563  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTIO Line 7563  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTIO
7563  pcre_compile(const char *pattern, int options, const char **errorptr,  pcre_compile(const char *pattern, int options, const char **errorptr,
7564    int *erroroffset, const unsigned char *tables)    int *erroroffset, const unsigned char *tables)
7565  #else  #else
7566  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION  PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION
7567  pcre16_compile(PCRE_SPTR16 pattern, int options, const char **errorptr,  pcre16_compile(PCRE_SPTR16 pattern, int options, const char **errorptr,
7568    int *erroroffset, const unsigned char *tables)    int *erroroffset, const unsigned char *tables)
7569  #endif  #endif
# Line 7581  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTIO Line 7581  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTIO
7581  pcre_compile2(const char *pattern, int options, int *errorcodeptr,  pcre_compile2(const char *pattern, int options, int *errorcodeptr,
7582    const char **errorptr, int *erroroffset, const unsigned char *tables)    const char **errorptr, int *erroroffset, const unsigned char *tables)
7583  #else  #else
7584  PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION  PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION
7585  pcre16_compile2(PCRE_SPTR16 pattern, int options, int *errorcodeptr,  pcre16_compile2(PCRE_SPTR16 pattern, int options, int *errorcodeptr,
7586    const char **errorptr, int *erroroffset, const unsigned char *tables)    const char **errorptr, int *erroroffset, const unsigned char *tables)
7587  #endif  #endif
7588  {  {
7589  real_pcre *re;  REAL_PCRE *re;
7590  int length = 1;  /* For final END opcode */  int length = 1;  /* For final END opcode */
7591  pcre_int32 firstchar, reqchar;  pcre_int32 firstchar, reqchar;
7592  int newline;  int newline;
# Line 7709  not used here. */ Line 7709  not used here. */
7709  if (utf && (options & PCRE_NO_UTF8_CHECK) == 0 &&  if (utf && (options & PCRE_NO_UTF8_CHECK) == 0 &&
7710       (errorcode = PRIV(valid_utf)((PCRE_PUCHAR)pattern, -1, erroroffset)) != 0)       (errorcode = PRIV(valid_utf)((PCRE_PUCHAR)pattern, -1, erroroffset)) != 0)
7711    {    {
7712  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
7713    errorcode = ERR44;    errorcode = ERR44;
7714  #else  #else
7715    errorcode = ERR74;    errorcode = ERR74;
7716  #endif  #endif
7717    goto PCRE_EARLY_ERROR_RETURN2;    goto PCRE_EARLY_ERROR_RETURN2;
7718    }    }
7719  #else  #else
# Line 7848  externally provided function. Integer ov Line 7848  externally provided function. Integer ov
7848  because nowadays we limit the maximum value of cd->names_found and  because nowadays we limit the maximum value of cd->names_found and
7849  cd->name_entry_size. */  cd->name_entry_size. */
7850    
7851  size = sizeof(real_pcre) + (length + cd->names_found * cd->name_entry_size) * sizeof(pcre_uchar);  size = sizeof(REAL_PCRE) + (length + cd->names_found * cd->name_entry_size) * sizeof(pcre_uchar);
7852  re = (real_pcre *)(PUBL(malloc))(size);  re = (REAL_PCRE *)(PUBL(malloc))(size);
7853    
7854  if (re == NULL)  if (re == NULL)
7855    {    {
# Line 7870  re->flags = cd->external_flags; Line 7870  re->flags = cd->external_flags;
7870  re->dummy1 = 0;  re->dummy1 = 0;
7871  re->first_char = 0;  re->first_char = 0;
7872  re->req_char = 0;  re->req_char = 0;
7873  re->name_table_offset = sizeof(real_pcre) / sizeof(pcre_uchar);  re->name_table_offset = sizeof(REAL_PCRE) / sizeof(pcre_uchar);
7874  re->name_entry_size = cd->name_entry_size;  re->name_entry_size = cd->name_entry_size;
7875  re->name_count = cd->names_found;  re->name_count = cd->names_found;
7876  re->ref_count = 0;  re->ref_count = 0;
# Line 8152  if (code - codestart > length) Line 8152  if (code - codestart > length)
8152    }    }
8153  #endif   /* PCRE_DEBUG */  #endif   /* PCRE_DEBUG */
8154    
8155    #ifdef COMPILE_PCRE8
8156  return (pcre *)re;  return (pcre *)re;
8157    #else
8158    return (pcre16 *)re;
8159    #endif
8160  }  }
8161    
8162  /* End of pcre_compile.c */  /* End of pcre_compile.c */

Legend:
Removed from v.849  
changed lines
  Added in v.903

  ViewVC Help
Powered by ViewVC 1.1.5