/[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 1414 by zherczeg, Sun Dec 22 16:27:35 2013 UTC revision 1415 by zherczeg, Sun Dec 22 20:47:08 2013 UTC
# Line 3070  const pcre_uint32 *chr_ptr; Line 3070  const pcre_uint32 *chr_ptr;
3070  const pcre_uint32 *ochr_ptr;  const pcre_uint32 *ochr_ptr;
3071  const pcre_uint32 *list_ptr;  const pcre_uint32 *list_ptr;
3072  const pcre_uchar *next_code;  const pcre_uchar *next_code;
3073    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3074    const pcre_uchar *xclass_flags;
3075    #endif
3076  const pcre_uint8 *class_bitset;  const pcre_uint8 *class_bitset;
3077  const pcre_uint32 *set1, *set2, *set_end;  const pcre_uint8 *set1, *set2, *set_end;
3078  pcre_uint32 chr;  pcre_uint32 chr;
3079  BOOL accepted, invert_bits;  BOOL accepted, invert_bits;
3080    
# Line 3202  for(;;) Line 3205  for(;;)
3205      if (base_list[0] == OP_CLASS)      if (base_list[0] == OP_CLASS)
3206  #endif  #endif
3207        {        {
3208        set1 = (pcre_uint32 *)(base_end - base_list[2]);        set1 = (pcre_uint8 *)(base_end - base_list[2]);
3209        list_ptr = list;        list_ptr = list;
3210        }        }
3211      else      else
3212        {        {
3213        set1 = (pcre_uint32 *)(code - list[2]);        set1 = (pcre_uint8 *)(code - list[2]);
3214        list_ptr = base_list;        list_ptr = base_list;
3215        }        }
3216    
# Line 3216  for(;;) Line 3219  for(;;)
3219        {        {
3220        case OP_CLASS:        case OP_CLASS:
3221        case OP_NCLASS:        case OP_NCLASS:
3222        set2 = (pcre_uint32 *)        set2 = (pcre_uint8 *)
3223          ((list_ptr == list ? code : base_end) - list_ptr[2]);          ((list_ptr == list ? code : base_end) - list_ptr[2]);
3224        break;        break;
3225    
3226        /* OP_XCLASS cannot be supported here, because its bitset  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3227        is not necessarily complete. E.g: [a-\0x{200}] is stored        case OP_XCLASS:
3228        as a character range, and the appropriate bits are not set. */        xclass_flags = (list_ptr == list ? code : base_end) - list_ptr[2] + LINK_SIZE;
3229          if ((*xclass_flags & XCL_HASPROP) != 0) return FALSE;
3230          if ((*xclass_flags & XCL_MAP) == 0)
3231            {
3232            /* No bits are set for characters < 256. */
3233            if (list[1] == 0) return TRUE;
3234            /* Might be an empty repeat. */
3235            continue;
3236            }
3237          set2 = (pcre_uint8 *)(xclass_flags + 1);
3238          break;
3239    #endif
3240    
3241        case OP_NOT_DIGIT:        case OP_NOT_DIGIT:
3242          invert_bits = TRUE;        invert_bits = TRUE;
3243          /* Fall through */        /* Fall through */
3244        case OP_DIGIT:        case OP_DIGIT:
3245          set2 = (pcre_uint32 *)(cd->cbits + cbit_digit);        set2 = (pcre_uint8 *)(cd->cbits + cbit_digit);
3246          break;        break;
3247    
3248        case OP_NOT_WHITESPACE:        case OP_NOT_WHITESPACE:
3249          invert_bits = TRUE;        invert_bits = TRUE;
3250          /* Fall through */        /* Fall through */
3251        case OP_WHITESPACE:        case OP_WHITESPACE:
3252          set2 = (pcre_uint32 *)(cd->cbits + cbit_space);        set2 = (pcre_uint8 *)(cd->cbits + cbit_space);
3253          break;        break;
3254    
3255        case OP_NOT_WORDCHAR:        case OP_NOT_WORDCHAR:
3256          invert_bits = TRUE;        invert_bits = TRUE;
3257          /* Fall through */        /* Fall through */
3258        case OP_WORDCHAR:        case OP_WORDCHAR:
3259          set2 = (pcre_uint32 *)(cd->cbits + cbit_word);        set2 = (pcre_uint8 *)(cd->cbits + cbit_word);
3260          break;        break;
3261    
3262        default:        default:
3263        return FALSE;        return FALSE;
3264        }        }
3265    
3266      /* Compare 4 bytes to improve speed. */      /* Because the sets are unaligned, we need
3267      set_end = set1 + (32 / 4);      to perform byte comparison here. */
3268        set_end = set1 + 32;
3269      if (invert_bits)      if (invert_bits)
3270        {        {
3271        do        do

Legend:
Removed from v.1414  
changed lines
  Added in v.1415

  ViewVC Help
Powered by ViewVC 1.1.5