/[pcre]/code/branches/pcre16/pcre_compile.c
ViewVC logotype

Diff of /code/branches/pcre16/pcre_compile.c

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

revision 759 by zherczeg, Mon Nov 21 18:57:34 2011 UTC revision 763 by zherczeg, Tue Nov 22 21:46:22 2011 UTC
# Line 1072  get_ucp(const pcre_uchar **ptrptr, BOOL Line 1072  get_ucp(const pcre_uchar **ptrptr, BOOL
1072  {  {
1073  int c, i, bot, top;  int c, i, bot, top;
1074  const pcre_uchar *ptr = *ptrptr;  const pcre_uchar *ptr = *ptrptr;
1075  char name[32];  pcre_uchar name[32];
1076    
1077  c = *(++ptr);  c = *(++ptr);
1078  if (c == 0) goto ERROR_RETURN;  if (c == 0) goto ERROR_RETURN;
# Line 1118  top = _pcre_utt_size; Line 1118  top = _pcre_utt_size;
1118  while (bot < top)  while (bot < top)
1119    {    {
1120    i = (bot + top) >> 1;    i = (bot + top) >> 1;
1121    c = strcmp(name, _pcre_utt_names + _pcre_utt[i].name_offset);    c = STRCMP_UC_C8(name, _pcre_utt_names + _pcre_utt[i].name_offset);
1122    if (c == 0)    if (c == 0)
1123      {      {
1124      *dptr = _pcre_utt[i].value;      *dptr = _pcre_utt[i].value;
# Line 1324  if (ptr[0] == CHAR_LEFT_PARENTHESIS) Line 1324  if (ptr[0] == CHAR_LEFT_PARENTHESIS)
1324        thisname = ptr;        thisname = ptr;
1325        while (*ptr != term) ptr++;        while (*ptr != term) ptr++;
1326        if (name != NULL && lorn == ptr - thisname &&        if (name != NULL && lorn == ptr - thisname &&
1327            strncmp((const char *)name, (const char *)thisname, lorn) == 0)            STRNCMP_UC_UC(name, thisname, lorn) == 0)
1328          return *count;          return *count;
1329        term++;        term++;
1330        }        }
# Line 1367  for (; ptr < cd->end_pattern; ptr++) Line 1367  for (; ptr < cd->end_pattern; ptr++)
1367          {          {
1368          if (ptr[2] == CHAR_E)          if (ptr[2] == CHAR_E)
1369            ptr+= 2;            ptr+= 2;
1370          else if (strncmp((const char *)ptr+2,          else if (STRNCMP_UC_C8(ptr + 2,
1371                   STR_Q STR_BACKSLASH STR_E, 3) == 0)                   STR_Q STR_BACKSLASH STR_E, 3) == 0)
1372            ptr += 4;            ptr += 4;
1373          else          else
# Line 2579  register int yield = 0; Line 2579  register int yield = 0;
2579  while (posix_name_lengths[yield] != 0)  while (posix_name_lengths[yield] != 0)
2580    {    {
2581    if (len == posix_name_lengths[yield] &&    if (len == posix_name_lengths[yield] &&
2582      strncmp((const char *)ptr, pn, len) == 0) return yield;      STRNCMP_UC_C8(ptr, pn, len) == 0) return yield;
2583    pn += posix_name_lengths[yield] + 1;    pn += posix_name_lengths[yield] + 1;
2584    yield++;    yield++;
2585    }    }
# Line 2915  if ((options & PCRE_EXTENDED) != 0) Line 2915  if ((options & PCRE_EXTENDED) != 0)
2915  /* If the next thing is itself optional, we have to give up. */  /* If the next thing is itself optional, we have to give up. */
2916    
2917  if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||  if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||
2918    strncmp((char *)ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)    STRNCMP_UC_C8(ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)
2919      return FALSE;      return FALSE;
2920    
2921  /* Now compare the next item with the previous opcode. First, handle cases when  /* Now compare the next item with the previous opcode. First, handle cases when
# Line 3177  switch(op_code) Line 3177  switch(op_code)
3177        to the original \d etc. At this point, ptr will point to a zero byte. */        to the original \d etc. At this point, ptr will point to a zero byte. */
3178    
3179        if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||        if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||
3180          strncmp((char *)ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)          STRNCMP_UC_C8(ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)
3181            return FALSE;            return FALSE;
3182    
3183        /* Do the property check. */        /* Do the property check. */
# Line 3617  for (;; ptr++) Line 3617  for (;; ptr++)
3617          {          {
3618          if (ptr[1] == CHAR_E)          if (ptr[1] == CHAR_E)
3619            ptr++;            ptr++;
3620          else if (strncmp((const char *)ptr+1,          else if (STRNCMP_UC_C8(ptr + 1,
3621                            STR_Q STR_BACKSLASH STR_E, 3) == 0)                            STR_Q STR_BACKSLASH STR_E, 3) == 0)
3622            ptr += 3;            ptr += 3;
3623          else          else
# Line 5295  for (;; ptr++) Line 5295  for (;; ptr++)
5295        for (i = 0; i < verbcount; i++)        for (i = 0; i < verbcount; i++)
5296          {          {
5297          if (namelen == verbs[i].len &&          if (namelen == verbs[i].len &&
5298              strncmp((char *)name, vn, namelen) == 0)              STRNCMP_UC_C8(name, vn, namelen) == 0)
5299            {            {
5300            /* Check for open captures before ACCEPT and convert it to            /* Check for open captures before ACCEPT and convert it to
5301            ASSERT_ACCEPT if in an assertion. */            ASSERT_ACCEPT if in an assertion. */
# Line 5519  for (;; ptr++) Line 5519  for (;; ptr++)
5519          slot = cd->name_table;          slot = cd->name_table;
5520          for (i = 0; i < cd->names_found; i++)          for (i = 0; i < cd->names_found; i++)
5521            {            {
5522            if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;            if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) == 0) break;
5523            slot += cd->name_entry_size;            slot += cd->name_entry_size;
5524            }            }
5525    
# Line 5576  for (;; ptr++) Line 5576  for (;; ptr++)
5576          /* Similarly, check for the (?(DEFINE) "condition", which is always          /* Similarly, check for the (?(DEFINE) "condition", which is always
5577          false. */          false. */
5578    
5579          else if (namelen == 6 && strncmp((char *)name, STRING_DEFINE, 6) == 0)          else if (namelen == 6 && STRNCMP_UC_C8(name, STRING_DEFINE, 6) == 0)
5580            {            {
5581            code[1+LINK_SIZE] = OP_DEF;            code[1+LINK_SIZE] = OP_DEF;
5582            skipbytes = 1;            skipbytes = 1;
# Line 5894  for (;; ptr++) Line 5894  for (;; ptr++)
5894            slot = cd->name_table;            slot = cd->name_table;
5895            for (i = 0; i < cd->names_found; i++)            for (i = 0; i < cd->names_found; i++)
5896              {              {
5897              if (strncmp((char *)name, (char *)slot+2, namelen) == 0 &&              if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) == 0 &&
5898                  slot[2+namelen] == 0)                  slot[2+namelen] == 0)
5899                break;                break;
5900              slot += cd->name_entry_size;              slot += cd->name_entry_size;
# Line 7348  while (ptr[skipatstart] == CHAR_LEFT_PAR Line 7348  while (ptr[skipatstart] == CHAR_LEFT_PAR
7348    int newnl = 0;    int newnl = 0;
7349    int newbsr = 0;    int newbsr = 0;
7350    
7351    if (strncmp((char *)(ptr+skipatstart+2), STRING_UTF8_RIGHTPAR, 5) == 0)    if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UTF8_RIGHTPAR, 5) == 0)
7352      { skipatstart += 7; options |= PCRE_UTF8; continue; }      { skipatstart += 7; options |= PCRE_UTF8; continue; }
7353    else if (strncmp((char *)(ptr+skipatstart+2), STRING_UCP_RIGHTPAR, 4) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UCP_RIGHTPAR, 4) == 0)
7354      { skipatstart += 6; options |= PCRE_UCP; continue; }      { skipatstart += 6; options |= PCRE_UCP; continue; }
7355    else if (strncmp((char *)(ptr+skipatstart+2), STRING_NO_START_OPT_RIGHTPAR, 13) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_NO_START_OPT_RIGHTPAR, 13) == 0)
7356      { skipatstart += 15; options |= PCRE_NO_START_OPTIMIZE; continue; }      { skipatstart += 15; options |= PCRE_NO_START_OPTIMIZE; continue; }
7357    
7358    if (strncmp((char *)(ptr+skipatstart+2), STRING_CR_RIGHTPAR, 3) == 0)    if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_CR_RIGHTPAR, 3) == 0)
7359      { skipatstart += 5; newnl = PCRE_NEWLINE_CR; }      { skipatstart += 5; newnl = PCRE_NEWLINE_CR; }
7360    else if (strncmp((char *)(ptr+skipatstart+2), STRING_LF_RIGHTPAR, 3)  == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_LF_RIGHTPAR, 3)  == 0)
7361      { skipatstart += 5; newnl = PCRE_NEWLINE_LF; }      { skipatstart += 5; newnl = PCRE_NEWLINE_LF; }
7362    else if (strncmp((char *)(ptr+skipatstart+2), STRING_CRLF_RIGHTPAR, 5)  == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_CRLF_RIGHTPAR, 5)  == 0)
7363      { skipatstart += 7; newnl = PCRE_NEWLINE_CR + PCRE_NEWLINE_LF; }      { skipatstart += 7; newnl = PCRE_NEWLINE_CR + PCRE_NEWLINE_LF; }
7364    else if (strncmp((char *)(ptr+skipatstart+2), STRING_ANY_RIGHTPAR, 4) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_ANY_RIGHTPAR, 4) == 0)
7365      { skipatstart += 6; newnl = PCRE_NEWLINE_ANY; }      { skipatstart += 6; newnl = PCRE_NEWLINE_ANY; }
7366    else if (strncmp((char *)(ptr+skipatstart+2), STRING_ANYCRLF_RIGHTPAR, 8) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_ANYCRLF_RIGHTPAR, 8) == 0)
7367      { skipatstart += 10; newnl = PCRE_NEWLINE_ANYCRLF; }      { skipatstart += 10; newnl = PCRE_NEWLINE_ANYCRLF; }
7368    
7369    else if (strncmp((char *)(ptr+skipatstart+2), STRING_BSR_ANYCRLF_RIGHTPAR, 12) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_BSR_ANYCRLF_RIGHTPAR, 12) == 0)
7370      { skipatstart += 14; newbsr = PCRE_BSR_ANYCRLF; }      { skipatstart += 14; newbsr = PCRE_BSR_ANYCRLF; }
7371    else if (strncmp((char *)(ptr+skipatstart+2), STRING_BSR_UNICODE_RIGHTPAR, 12) == 0)    else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_BSR_UNICODE_RIGHTPAR, 12) == 0)
7372      { skipatstart += 14; newbsr = PCRE_BSR_UNICODE; }      { skipatstart += 14; newbsr = PCRE_BSR_UNICODE; }
7373    
7374    if (newnl != 0)    if (newnl != 0)
# Line 7486  cd->start_workspace = cworkspace; Line 7486  cd->start_workspace = cworkspace;
7486  cd->start_code = cworkspace;  cd->start_code = cworkspace;
7487  cd->hwm = cworkspace;  cd->hwm = cworkspace;
7488  cd->start_pattern = (const pcre_uchar *)pattern;  cd->start_pattern = (const pcre_uchar *)pattern;
7489  cd->end_pattern = (const pcre_uchar *)(pattern + strlen(pattern));  cd->end_pattern = (const pcre_uchar *)(pattern + STRLEN_UC(pattern));
7490  cd->req_varyopt = 0;  cd->req_varyopt = 0;
7491  cd->external_options = options;  cd->external_options = options;
7492  cd->external_flags = 0;  cd->external_flags = 0;

Legend:
Removed from v.759  
changed lines
  Added in v.763

  ViewVC Help
Powered by ViewVC 1.1.5