/[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 1072 by chpe, Tue Oct 16 15:54:40 2012 UTC revision 1124 by chpe, Thu Oct 18 18:34:53 2012 UTC
# Line 84  static int Line 84  static int
84      const pcre_uint32 *, unsigned int);      const pcre_uint32 *, unsigned int);
85    
86  static BOOL  static BOOL
87    compile_regex(int, pcre_uchar **, const pcre_uchar **, int *, BOOL, BOOL,    compile_regex(int, pcre_uchar **, const pcre_uchar **, int *, BOOL, BOOL, int, int,
88      int, int, int *, int *, branch_chain *, compile_data *, int *);      pcre_uint32 *, pcre_int32 *, pcre_uint32 *, pcre_int32 *, branch_chain *,
89        compile_data *, int *);
90    
91    
92    
# Line 121  overrun before it actually does run off Line 122  overrun before it actually does run off
122    
123  /* Private flags added to firstchar and reqchar. */  /* Private flags added to firstchar and reqchar. */
124    
125  #define REQ_CASELESS   0x10000000l      /* Indicates caselessness */  #define REQ_CASELESS    (1 << 0)        /* Indicates caselessness */
126  #define REQ_VARY       0x20000000l      /* Reqchar followed non-literal item */  #define REQ_VARY        (1 << 1)        /* Reqchar followed non-literal item */
127  #define REQ_MASK       (REQ_CASELESS | REQ_VARY)  /* Negative values for the firstchar and reqchar flags */
128    #define REQ_UNSET       (-2)
129    #define REQ_NONE        (-1)
130    
131  /* Repeated character flags. */  /* Repeated character flags. */
132    
# Line 645  static const pcre_uint8 ebcdic_chartab[] Line 648  static const pcre_uint8 ebcdic_chartab[]
648    
649    
650    
   
651  /*************************************************  /*************************************************
652  *            Find an error text                  *  *            Find an error text                  *
653  *************************************************/  *************************************************/
# Line 1852  for (;;) Line 1854  for (;;)
1854      case OP_NOTI:      case OP_NOTI:
1855      branchlength++;      branchlength++;
1856      cc += 2;      cc += 2;
1857  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1858      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1859  #endif  #endif
1860      break;      break;
# Line 1866  for (;;) Line 1868  for (;;)
1868      case OP_NOTEXACTI:      case OP_NOTEXACTI:
1869      branchlength += (int)GET2(cc,1);      branchlength += (int)GET2(cc,1);
1870      cc += 2 + IMM2_SIZE;      cc += 2 + IMM2_SIZE;
1871  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
1872      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1873  #endif  #endif
1874      break;      break;
# Line 2755  register int yield = 0; Line 2757  register int yield = 0;
2757  while (posix_name_lengths[yield] != 0)  while (posix_name_lengths[yield] != 0)
2758    {    {
2759    if (len == posix_name_lengths[yield] &&    if (len == posix_name_lengths[yield] &&
2760      STRNCMP_UC_C8(ptr, pn, len) == 0) return yield;      STRNCMP_UC_C8(ptr, pn, (unsigned int)len) == 0) return yield;
2761    pn += posix_name_lengths[yield] + 1;    pn += posix_name_lengths[yield] + 1;
2762    yield++;    yield++;
2763    }    }
# Line 2810  while ((ptr = (pcre_uchar *)find_recurse Line 2812  while ((ptr = (pcre_uchar *)find_recurse
2812    
2813    for (hc = save_hwm; hc < cd->hwm; hc += LINK_SIZE)    for (hc = save_hwm; hc < cd->hwm; hc += LINK_SIZE)
2814      {      {
2815      offset = GET(hc, 0);      offset = (int)GET(hc, 0);
2816      if (cd->start_code + offset == ptr + 1)      if (cd->start_code + offset == ptr + 1)
2817        {        {
2818        PUT(hc, 0, offset + adjust);        PUT(hc, 0, offset + adjust);
# Line 2823  while ((ptr = (pcre_uchar *)find_recurse Line 2825  while ((ptr = (pcre_uchar *)find_recurse
2825    
2826    if (hc >= cd->hwm)    if (hc >= cd->hwm)
2827      {      {
2828      offset = GET(ptr, 1);      offset = (int)GET(ptr, 1);
2829      if (cd->start_code + offset >= group) PUT(ptr, 1, offset + adjust);      if (cd->start_code + offset >= group) PUT(ptr, 1, offset + adjust);
2830      }      }
2831    
# Line 3053  check_auto_possessive(const pcre_uchar * Line 3055  check_auto_possessive(const pcre_uchar *
3055  pcre_uint32 c = NOTACHAR;  pcre_uint32 c = NOTACHAR;
3056  pcre_uint32 next;  pcre_uint32 next;
3057  int escape;  int escape;
3058  int op_code = *previous++;  pcre_uchar op_code = *previous++;
3059    
3060  /* Skip whitespace and comments in extended mode */  /* Skip whitespace and comments in extended mode */
3061    
# Line 3131  if (*ptr == CHAR_ASTERISK || *ptr == CHA Line 3133  if (*ptr == CHAR_ASTERISK || *ptr == CHA
3133    
3134  if (op_code == OP_CHAR || op_code == OP_CHARI ||  if (op_code == OP_CHAR || op_code == OP_CHARI ||
3135      op_code == OP_NOT || op_code == OP_NOTI)      op_code == OP_NOT || op_code == OP_NOTI)
   //if (escape == 0) switch(op_code)  
3136    {    {
3137  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3138    GETCHARTEST(c, previous);    GETCHARTEST(c, previous);
# Line 3251  if (escape == 0) Line 3252  if (escape == 0)
3252    
3253  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3254      case OP_PROP:      case OP_PROP:
3255      return check_char_prop(next, previous[0], previous[1], FALSE);      return check_char_prop(next, (int)previous[0], (int)previous[1], FALSE);
3256    
3257      case OP_NOTPROP:      case OP_NOTPROP:
3258      return check_char_prop(next, previous[0], previous[1], TRUE);      return check_char_prop(next, (int)previous[0], (int)previous[1], TRUE);
3259  #endif  #endif
3260    
3261      default:      default:
# Line 3666  Arguments: Line 3667  Arguments:
3667    codeptr        points to the pointer to the current code point    codeptr        points to the pointer to the current code point
3668    ptrptr         points to the current pattern pointer    ptrptr         points to the current pattern pointer
3669    errorcodeptr   points to error code variable    errorcodeptr   points to error code variable
3670    firstcharptr   set to initial literal character, or < 0 (REQ_UNSET, REQ_NONE)    firstcharptr    place to put the first required character
3671    reqcharptr     set to the last literal character required, else < 0    firstcharflagsptr place to put the first character flags, or a negative number
3672      reqcharptr     place to put the last required character
3673      reqcharflagsptr place to put the last required character flags, or a negative number
3674    bcptr          points to current branch chain    bcptr          points to current branch chain
3675    cond_depth     conditional nesting depth    cond_depth     conditional nesting depth
3676    cd             contains pointers to tables etc.    cd             contains pointers to tables etc.
# Line 3680  Returns:         TRUE on success Line 3683  Returns:         TRUE on success
3683    
3684  static BOOL  static BOOL
3685  compile_branch(int *optionsptr, pcre_uchar **codeptr,  compile_branch(int *optionsptr, pcre_uchar **codeptr,
3686    const pcre_uchar **ptrptr, int *errorcodeptr, pcre_int32 *firstcharptr,    const pcre_uchar **ptrptr, int *errorcodeptr,
3687    pcre_int32 *reqcharptr, branch_chain *bcptr, int cond_depth,    pcre_uint32 *firstcharptr, pcre_int32 *firstcharflagsptr,
3688      pcre_uint32 *reqcharptr, pcre_int32 *reqcharflagsptr,
3689      branch_chain *bcptr, int cond_depth,
3690    compile_data *cd, int *lengthptr)    compile_data *cd, int *lengthptr)
3691  {  {
3692  int repeat_type, op_type;  int repeat_type, op_type;
3693  int repeat_min = 0, repeat_max = 0;      /* To please picky compilers */  int repeat_min = 0, repeat_max = 0;      /* To please picky compilers */
3694  int bravalue = 0;  int bravalue = 0;
3695  int greedy_default, greedy_non_default;  int greedy_default, greedy_non_default;
3696  pcre_int32 firstchar, reqchar;  pcre_uint32 firstchar, reqchar;
3697  pcre_int32 zeroreqchar, zerofirstchar;  pcre_int32 firstcharflags, reqcharflags;
3698    pcre_uint32 zeroreqchar, zerofirstchar;
3699    pcre_int32 zeroreqcharflags, zerofirstcharflags;
3700  pcre_int32 req_caseopt, reqvary, tempreqvary;  pcre_int32 req_caseopt, reqvary, tempreqvary;
3701  int options = *optionsptr;               /* May change dynamically */  int options = *optionsptr;               /* May change dynamically */
3702  int after_manual_callout = 0;  int after_manual_callout = 0;
# Line 3717  dynamically as we process the pattern. * Line 3724  dynamically as we process the pattern. *
3724  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3725  /* PCRE_UTF[16|32] have the same value as PCRE_UTF8. */  /* PCRE_UTF[16|32] have the same value as PCRE_UTF8. */
3726  BOOL utf = (options & PCRE_UTF8) != 0;  BOOL utf = (options & PCRE_UTF8) != 0;
3727    #ifndef COMPILE_PCRE32
3728  pcre_uchar utf_chars[6];  pcre_uchar utf_chars[6];
3729    #endif
3730  #else  #else
3731  BOOL utf = FALSE;  BOOL utf = FALSE;
3732  #endif  #endif
# Line 3752  to take the zero repeat into account. Th Line 3761  to take the zero repeat into account. Th
3761  zerofirstbyte and zeroreqchar when such a repeat is encountered. The individual  zerofirstbyte and zeroreqchar when such a repeat is encountered. The individual
3762  item types that can be repeated set these backoff variables appropriately. */  item types that can be repeated set these backoff variables appropriately. */
3763    
3764  firstchar = reqchar = zerofirstchar = zeroreqchar = REQ_UNSET;  firstchar = reqchar = zerofirstchar = zeroreqchar = 0;
3765    firstcharflags = reqcharflags = zerofirstcharflags = zeroreqcharflags = REQ_UNSET;
3766    
3767  /* The variable req_caseopt contains either the REQ_CASELESS value  /* The variable req_caseopt contains either the REQ_CASELESS value
3768  or zero, according to the current setting of the caseless flag. The  or zero, according to the current setting of the caseless flag. The
# Line 3778  for (;; ptr++) Line 3788  for (;; ptr++)
3788    int recno;    int recno;
3789    int refsign;    int refsign;
3790    int skipbytes;    int skipbytes;
3791    int subreqchar;    pcre_uint32 subreqchar, subfirstchar;
3792    int subfirstchar;    pcre_int32 subreqcharflags, subfirstcharflags;
3793    int terminator;    int terminator;
3794    int mclength;    int mclength;
3795    int tempbracount;    int tempbracount;
3796    int ec; // FIXMEchpe pcre_uint32    pcre_uint32 ec;
3797    pcre_uchar mcbuffer[8];    pcre_uchar mcbuffer[8];
3798    
3799    /* Get next character in the pattern */    /* Get next character in the pattern */
# Line 3946  for (;; ptr++) Line 3956  for (;; ptr++)
3956      case CHAR_VERTICAL_LINE:       /* or | or ) */      case CHAR_VERTICAL_LINE:       /* or | or ) */
3957      case CHAR_RIGHT_PARENTHESIS:      case CHAR_RIGHT_PARENTHESIS:
3958      *firstcharptr = firstchar;      *firstcharptr = firstchar;
3959        *firstcharflagsptr = firstcharflags;
3960      *reqcharptr = reqchar;      *reqcharptr = reqchar;
3961        *reqcharflagsptr = reqcharflags;
3962      *codeptr = code;      *codeptr = code;
3963      *ptrptr = ptr;      *ptrptr = ptr;
3964      if (lengthptr != NULL)      if (lengthptr != NULL)
# Line 3970  for (;; ptr++) Line 3982  for (;; ptr++)
3982      previous = NULL;      previous = NULL;
3983      if ((options & PCRE_MULTILINE) != 0)      if ((options & PCRE_MULTILINE) != 0)
3984        {        {
3985        if (firstchar == REQ_UNSET) firstchar = REQ_NONE;        if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
3986        *code++ = OP_CIRCM;        *code++ = OP_CIRCM;
3987        }        }
3988      else *code++ = OP_CIRC;      else *code++ = OP_CIRC;
# Line 3985  for (;; ptr++) Line 3997  for (;; ptr++)
3997      repeats. The value of reqchar doesn't change either. */      repeats. The value of reqchar doesn't change either. */
3998    
3999      case CHAR_DOT:      case CHAR_DOT:
4000      if (firstchar == REQ_UNSET) firstchar = REQ_NONE;      if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
4001      zerofirstchar = firstchar;      zerofirstchar = firstchar;
4002        zerofirstcharflags = firstcharflags;
4003      zeroreqchar = reqchar;      zeroreqchar = reqchar;
4004        zeroreqcharflags = reqcharflags;
4005      previous = code;      previous = code;
4006      *code++ = ((options & PCRE_DOTALL) != 0)? OP_ALLANY: OP_ANY;      *code++ = ((options & PCRE_DOTALL) != 0)? OP_ALLANY: OP_ANY;
4007      break;      break;
# Line 4061  for (;; ptr++) Line 4075  for (;; ptr++)
4075          (cd->external_options & PCRE_JAVASCRIPT_COMPAT) != 0)          (cd->external_options & PCRE_JAVASCRIPT_COMPAT) != 0)
4076        {        {
4077        *code++ = negate_class? OP_ALLANY : OP_FAIL;        *code++ = negate_class? OP_ALLANY : OP_FAIL;
4078        if (firstchar == REQ_UNSET) firstchar = REQ_NONE;        if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
4079        zerofirstchar = firstchar;        zerofirstchar = firstchar;
4080          zerofirstcharflags = firstcharflags;
4081        break;        break;
4082        }        }
4083    
# Line 4101  for (;; ptr++) Line 4116  for (;; ptr++)
4116        {        {
4117        const pcre_uchar *oldptr;        const pcre_uchar *oldptr;
4118    
4119  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
4120        if (utf && HAS_EXTRALEN(c))        if (utf && HAS_EXTRALEN(c))
4121          {                           /* Braces are required because the */          {                           /* Braces are required because the */
4122          GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */          GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */
# Line 4416  for (;; ptr++) Line 4431  for (;; ptr++)
4431    
4432        if (!inescq && ptr[1] == CHAR_MINUS)        if (!inescq && ptr[1] == CHAR_MINUS)
4433          {          {
4434          int d;          pcre_uint32 d;
4435          ptr += 2;          ptr += 2;
4436          while (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_E) ptr += 2;          while (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_E) ptr += 2;
4437    
# Line 4522  for (;; ptr++) Line 4537  for (;; ptr++)
4537          {          {
4538          ptr++;          ptr++;
4539          zeroreqchar = reqchar;          zeroreqchar = reqchar;
4540            zeroreqcharflags = reqcharflags;
4541    
4542          if (negate_class)          if (negate_class)
4543            {            {
4544  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
             // FIXMEchpe pcreuint32?  
4545            int d;            int d;
4546  #endif  #endif
4547            if (firstchar == REQ_UNSET) firstchar = REQ_NONE;            if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
4548            zerofirstchar = firstchar;            zerofirstchar = firstchar;
4549              zerofirstcharflags = firstcharflags;
4550    
4551            /* For caseless UTF-8 mode when UCP support is available, check            /* For caseless UTF-8 mode when UCP support is available, check
4552            whether this character has more than one other case. If so, generate            whether this character has more than one other case. If so, generate
# Line 4618  for (;; ptr++) Line 4634  for (;; ptr++)
4634      setting, whatever the repeat count. Any reqchar setting must remain      setting, whatever the repeat count. Any reqchar setting must remain
4635      unchanged after any kind of repeat. */      unchanged after any kind of repeat. */
4636    
4637      if (firstchar == REQ_UNSET) firstchar = REQ_NONE;      if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
4638      zerofirstchar = firstchar;      zerofirstchar = firstchar;
4639        zerofirstcharflags = firstcharflags;
4640      zeroreqchar = reqchar;      zeroreqchar = reqchar;
4641        zeroreqcharflags = reqcharflags;
4642    
4643      /* If there are characters with values > 255, we have to compile an      /* If there are characters with values > 255, we have to compile an
4644      extended class, with its own opcode, unless there was a negated special      extended class, with its own opcode, unless there was a negated special
# Line 4715  for (;; ptr++) Line 4733  for (;; ptr++)
4733      if (repeat_min == 0)      if (repeat_min == 0)
4734        {        {
4735        firstchar = zerofirstchar;    /* Adjust for zero repeat */        firstchar = zerofirstchar;    /* Adjust for zero repeat */
4736          firstcharflags = zerofirstcharflags;
4737        reqchar = zeroreqchar;        /* Ditto */        reqchar = zeroreqchar;        /* Ditto */
4738          reqcharflags = zeroreqcharflags;
4739        }        }
4740    
4741      /* Remember whether this is a variable length repeat */      /* Remember whether this is a variable length repeat */
# Line 4818  for (;; ptr++) Line 4838  for (;; ptr++)
4838          {          {
4839          c = code[-1];          c = code[-1];
4840          if (*previous <= OP_CHARI && repeat_min > 1)          if (*previous <= OP_CHARI && repeat_min > 1)
4841            reqchar = c | req_caseopt | cd->req_varyopt;            {
4842              reqchar = c;
4843              reqcharflags = req_caseopt | cd->req_varyopt;
4844              }
4845          }          }
4846    
4847        /* If the repetition is unlimited, it pays to see if the next thing on        /* If the repetition is unlimited, it pays to see if the next thing on
# Line 5200  for (;; ptr++) Line 5223  for (;; ptr++)
5223    
5224            else            else
5225              {              {
5226              if (groupsetfirstchar && reqchar < 0) reqchar = firstchar;              if (groupsetfirstchar && reqcharflags < 0)
5227                  {
5228                  reqchar = firstchar;
5229                  reqcharflags = firstcharflags;
5230                  }
5231    
5232              for (i = 1; i < repeat_min; i++)              for (i = 1; i < repeat_min; i++)
5233                {                {
# Line 5479  for (;; ptr++) Line 5506  for (;; ptr++)
5506        else if (*tempcode == OP_EXACT || *tempcode == OP_NOTEXACT)        else if (*tempcode == OP_EXACT || *tempcode == OP_NOTEXACT)
5507          {          {
5508          tempcode += PRIV(OP_lengths)[*tempcode];          tempcode += PRIV(OP_lengths)[*tempcode];
5509  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
5510          if (utf && HAS_EXTRALEN(tempcode[-1]))          if (utf && HAS_EXTRALEN(tempcode[-1]))
5511            tempcode += GET_EXTRALEN(tempcode[-1]);            tempcode += GET_EXTRALEN(tempcode[-1]);
5512  #endif  #endif
# Line 5620  for (;; ptr++) Line 5647  for (;; ptr++)
5647                (cd->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;                (cd->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;
5648    
5649              /* Do not set firstchar after *ACCEPT */              /* Do not set firstchar after *ACCEPT */
5650              if (firstchar == REQ_UNSET) firstchar = REQ_NONE;              if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
5651              }              }
5652    
5653            /* Handle other cases with/without an argument */            /* Handle other cases with/without an argument */
# Line 5786  for (;; ptr++) Line 5813  for (;; ptr++)
5813          while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0)          while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0)
5814            {            {
5815            if (recno >= 0)            if (recno >= 0)
5816              recno = (IS_DIGIT(*ptr))? recno * 10 + *ptr - CHAR_0 : -1;              recno = (IS_DIGIT(*ptr))? recno * 10 + (int)(*ptr - CHAR_0) : -1;
5817            ptr++;            ptr++;
5818            }            }
5819          namelen = (int)(ptr - name);          namelen = (int)(ptr - name);
# Line 6383  for (;; ptr++) Line 6410  for (;; ptr++)
6410    
6411          /* Can't determine a first byte now */          /* Can't determine a first byte now */
6412    
6413          if (firstchar == REQ_UNSET) firstchar = REQ_NONE;          if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
6414          continue;          continue;
6415    
6416    
# Line 6517  for (;; ptr++) Line 6544  for (;; ptr++)
6544           cond_depth +           cond_depth +
6545             ((bravalue == OP_COND)?1:0),   /* Depth of condition subpatterns */             ((bravalue == OP_COND)?1:0),   /* Depth of condition subpatterns */
6546           &subfirstchar,                   /* For possible first char */           &subfirstchar,                   /* For possible first char */
6547             &subfirstcharflags,
6548           &subreqchar,                     /* For possible last char */           &subreqchar,                     /* For possible last char */
6549             &subreqcharflags,
6550           bcptr,                           /* Current branch chain */           bcptr,                           /* Current branch chain */
6551           cd,                              /* Tables block */           cd,                              /* Tables block */
6552           (lengthptr == NULL)? NULL :      /* Actual compile phase */           (lengthptr == NULL)? NULL :      /* Actual compile phase */
# Line 6578  for (;; ptr++) Line 6607  for (;; ptr++)
6607            *errorcodeptr = ERR27;            *errorcodeptr = ERR27;
6608            goto FAILED;            goto FAILED;
6609            }            }
6610          if (condcount == 1) subfirstchar = subreqchar = REQ_NONE;          if (condcount == 1) subfirstcharflags = subreqcharflags = REQ_NONE;
6611          }          }
6612        }        }
6613    
# Line 6627  for (;; ptr++) Line 6656  for (;; ptr++)
6656      back off. */      back off. */
6657    
6658      zeroreqchar = reqchar;      zeroreqchar = reqchar;
6659        zeroreqcharflags = reqcharflags;
6660      zerofirstchar = firstchar;      zerofirstchar = firstchar;
6661        zerofirstcharflags = firstcharflags;
6662      groupsetfirstchar = FALSE;      groupsetfirstchar = FALSE;
6663    
6664      if (bravalue >= OP_ONCE)      if (bravalue >= OP_ONCE)
# Line 6638  for (;; ptr++) Line 6669  for (;; ptr++)
6669        no firstchar, set "none" for the whole branch. In both cases, a zero        no firstchar, set "none" for the whole branch. In both cases, a zero
6670        repeat forces firstchar to "none". */        repeat forces firstchar to "none". */
6671    
6672        if (firstchar == REQ_UNSET)        if (firstcharflags == REQ_UNSET)
6673          {          {
6674          if (subfirstchar >= 0)          if (subfirstcharflags >= 0)
6675            {            {
6676            firstchar = subfirstchar;            firstchar = subfirstchar;
6677              firstcharflags = subfirstcharflags;
6678            groupsetfirstchar = TRUE;            groupsetfirstchar = TRUE;
6679            }            }
6680          else firstchar = REQ_NONE;          else firstcharflags = REQ_NONE;
6681          zerofirstchar = REQ_NONE;          zerofirstcharflags = REQ_NONE;
6682          }          }
6683    
6684        /* If firstchar was previously set, convert the subpattern's firstchar        /* If firstchar was previously set, convert the subpattern's firstchar
6685        into reqchar if there wasn't one, using the vary flag that was in        into reqchar if there wasn't one, using the vary flag that was in
6686        existence beforehand. */        existence beforehand. */
6687    
6688        else if (subfirstchar >= 0 && subreqchar < 0)        else if (subfirstcharflags >= 0 && subreqcharflags < 0)
6689          subreqchar = subfirstchar | tempreqvary;          {
6690            subreqchar = subfirstchar;
6691            subreqcharflags = subfirstcharflags | tempreqvary;
6692            }
6693    
6694        /* If the subpattern set a required byte (or set a first byte that isn't        /* If the subpattern set a required byte (or set a first byte that isn't
6695        really the first byte - see above), set it. */        really the first byte - see above), set it. */
6696    
6697        if (subreqchar >= 0) reqchar = subreqchar;        if (subreqcharflags >= 0)
6698            {
6699            reqchar = subreqchar;
6700            reqcharflags = subreqcharflags;
6701            }
6702        }        }
6703    
6704      /* For a forward assertion, we take the reqchar, if set. This can be      /* For a forward assertion, we take the reqchar, if set. This can be
# Line 6670  for (;; ptr++) Line 6709  for (;; ptr++)
6709      of a firstchar. This is overcome by a scan at the end if there's no      of a firstchar. This is overcome by a scan at the end if there's no
6710      firstchar, looking for an asserted first char. */      firstchar, looking for an asserted first char. */
6711    
6712      else if (bravalue == OP_ASSERT && subreqchar >= 0) reqchar = subreqchar;      else if (bravalue == OP_ASSERT && subreqcharflags >= 0)
6713          {
6714          reqchar = subreqchar;
6715          reqcharflags = subreqcharflags;
6716          }
6717      break;     /* End of processing '(' */      break;     /* End of processing '(' */
6718    
6719    
# Line 6706  for (;; ptr++) Line 6749  for (;; ptr++)
6749        /* For metasequences that actually match a character, we disable the        /* For metasequences that actually match a character, we disable the
6750        setting of a first character if it hasn't already been set. */        setting of a first character if it hasn't already been set. */
6751    
6752        if (firstchar == REQ_UNSET && escape > ESC_b && escape < ESC_Z)        if (firstcharflags == REQ_UNSET && escape > ESC_b && escape < ESC_Z)
6753          firstchar = REQ_NONE;          firstcharflags = REQ_NONE;
6754    
6755        /* Set values to reset to if this is followed by a zero repeat. */        /* Set values to reset to if this is followed by a zero repeat. */
6756    
6757        zerofirstchar = firstchar;        zerofirstchar = firstchar;
6758          zerofirstcharflags = firstcharflags;
6759        zeroreqchar = reqchar;        zeroreqchar = reqchar;
6760          zeroreqcharflags = reqcharflags;
6761    
6762        /* \g<name> or \g'name' is a subroutine call by name and \g<n> or \g'n'        /* \g<name> or \g'name' is a subroutine call by name and \g<n> or \g'n'
6763        is a subroutine call by number (Oniguruma syntax). In fact, the value        is a subroutine call by number (Oniguruma syntax). In fact, the value
# Line 6802  for (;; ptr++) Line 6847  for (;; ptr++)
6847          recno = -escape;          recno = -escape;
6848    
6849          HANDLE_REFERENCE:    /* Come here from named backref handling */          HANDLE_REFERENCE:    /* Come here from named backref handling */
6850          if (firstchar == REQ_UNSET) firstchar = REQ_NONE;          if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
6851          previous = code;          previous = code;
6852          *code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;          *code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
6853          PUT2INC(code, 0, recno);          PUT2INC(code, 0, recno);
# Line 6905  for (;; ptr++) Line 6950  for (;; ptr++)
6950      mclength = 1;      mclength = 1;
6951      mcbuffer[0] = c;      mcbuffer[0] = c;
6952    
6953  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
6954      if (utf && HAS_EXTRALEN(c))      if (utf && HAS_EXTRALEN(c))
6955        ACROSSCHAR(TRUE, ptr[1], mcbuffer[mclength++] = *(++ptr));        ACROSSCHAR(TRUE, ptr[1], mcbuffer[mclength++] = *(++ptr));
6956  #endif  #endif
# Line 6929  for (;; ptr++) Line 6974  for (;; ptr++)
6974          *code++ = OP_PROP;          *code++ = OP_PROP;
6975          *code++ = PT_CLIST;          *code++ = PT_CLIST;
6976          *code++ = c;          *code++ = c;
6977          if (firstchar == REQ_UNSET) firstchar = zerofirstchar = REQ_NONE;          if (firstcharflags == REQ_UNSET) firstcharflags = zerofirstcharflags = REQ_NONE;
6978          break;          break;
6979          }          }
6980        }        }
# Line 6950  for (;; ptr++) Line 6995  for (;; ptr++)
6995      Otherwise, leave the firstchar value alone, and don't change it on a zero      Otherwise, leave the firstchar value alone, and don't change it on a zero
6996      repeat. */      repeat. */
6997    
6998      if (firstchar == REQ_UNSET)      if (firstcharflags == REQ_UNSET)
6999        {        {
7000        zerofirstchar = REQ_NONE;        zerofirstcharflags = REQ_NONE;
7001        zeroreqchar = reqchar;        zeroreqchar = reqchar;
7002          zeroreqcharflags = reqcharflags;
7003    
7004        /* If the character is more than one byte long, we can set firstchar        /* If the character is more than one byte long, we can set firstchar
7005        only if it is not to be matched caselessly. */        only if it is not to be matched caselessly. */
# Line 6961  for (;; ptr++) Line 7007  for (;; ptr++)
7007        if (mclength == 1 || req_caseopt == 0)        if (mclength == 1 || req_caseopt == 0)
7008          {          {
7009          firstchar = mcbuffer[0] | req_caseopt;          firstchar = mcbuffer[0] | req_caseopt;
7010          if (mclength != 1) reqchar = code[-1] | cd->req_varyopt;          firstchar = mcbuffer[0];
7011            firstcharflags = req_caseopt;
7012    
7013            if (mclength != 1)
7014              {
7015              reqchar = code[-1];
7016              reqcharflags = cd->req_varyopt;
7017              }
7018          }          }
7019        else firstchar = reqchar = REQ_NONE;        else firstcharflags = reqcharflags = REQ_NONE;
7020        }        }
7021    
7022      /* firstchar was previously set; we can set reqchar only if the length is      /* firstchar was previously set; we can set reqchar only if the length is
# Line 6972  for (;; ptr++) Line 7025  for (;; ptr++)
7025      else      else
7026        {        {
7027        zerofirstchar = firstchar;        zerofirstchar = firstchar;
7028          zerofirstcharflags = firstcharflags;
7029        zeroreqchar = reqchar;        zeroreqchar = reqchar;
7030          zeroreqcharflags = reqcharflags;
7031        if (mclength == 1 || req_caseopt == 0)        if (mclength == 1 || req_caseopt == 0)
7032          reqchar = code[-1] | req_caseopt | cd->req_varyopt;          {
7033            reqchar = code[-1];
7034            reqcharflags = req_caseopt | cd->req_varyopt;
7035            }
7036        }        }
7037    
7038      break;            /* End of literal character handling */      break;            /* End of literal character handling */
# Line 6993  return FALSE; Line 7051  return FALSE;
7051    
7052    
7053    
   
7054  /*************************************************  /*************************************************
7055  *     Compile sequence of alternatives           *  *     Compile sequence of alternatives           *
7056  *************************************************/  *************************************************/
# Line 7014  Arguments: Line 7071  Arguments:
7071    reset_bracount TRUE to reset the count for each branch    reset_bracount TRUE to reset the count for each branch
7072    skipbytes      skip this many bytes at start (for brackets and OP_COND)    skipbytes      skip this many bytes at start (for brackets and OP_COND)
7073    cond_depth     depth of nesting for conditional subpatterns    cond_depth     depth of nesting for conditional subpatterns
7074    firstcharptr   place to put the first required character, or a negative number    firstcharptr    place to put the first required character
7075    reqcharptr     place to put the last required character, or a negative number    firstcharflagsptr place to put the first character flags, or a negative number
7076      reqcharptr     place to put the last required character
7077      reqcharflagsptr place to put the last required character flags, or a negative number
7078    bcptr          pointer to the chain of currently open branches    bcptr          pointer to the chain of currently open branches
7079    cd             points to the data block with tables pointers etc.    cd             points to the data block with tables pointers etc.
7080    lengthptr      NULL during the real compile phase    lengthptr      NULL during the real compile phase
# Line 7027  Returns:         TRUE on success Line 7086  Returns:         TRUE on success
7086  static BOOL  static BOOL
7087  compile_regex(int options, pcre_uchar **codeptr, const pcre_uchar **ptrptr,  compile_regex(int options, pcre_uchar **codeptr, const pcre_uchar **ptrptr,
7088    int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes,    int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes,
7089    int cond_depth, pcre_int32 *firstcharptr, pcre_int32 *reqcharptr,    int cond_depth,
7090      pcre_uint32 *firstcharptr, pcre_int32 *firstcharflagsptr,
7091      pcre_uint32 *reqcharptr, pcre_int32 *reqcharflagsptr,
7092    branch_chain *bcptr, compile_data *cd, int *lengthptr)    branch_chain *bcptr, compile_data *cd, int *lengthptr)
7093  {  {
7094  const pcre_uchar *ptr = *ptrptr;  const pcre_uchar *ptr = *ptrptr;
# Line 7037  pcre_uchar *start_bracket = code; Line 7098  pcre_uchar *start_bracket = code;
7098  pcre_uchar *reverse_count = NULL;  pcre_uchar *reverse_count = NULL;
7099  open_capitem capitem;  open_capitem capitem;
7100  int capnumber = 0;  int capnumber = 0;
7101  pcre_int32 firstchar, reqchar;  pcre_uint32 firstchar, reqchar;
7102  pcre_int32 branchfirstchar, branchreqchar;  pcre_int32 firstcharflags, reqcharflags;
7103    pcre_uint32 branchfirstchar, branchreqchar;
7104    pcre_int32 branchfirstcharflags, branchreqcharflags;
7105  int length;  int length;
7106  int orig_bracount;  int orig_bracount;
7107  int max_bracount;  int max_bracount;
# Line 7047  branch_chain bc; Line 7110  branch_chain bc;
7110  bc.outer = bcptr;  bc.outer = bcptr;
7111  bc.current_branch = code;  bc.current_branch = code;
7112    
7113  firstchar = reqchar = REQ_UNSET;  firstchar = reqchar = 0;
7114    firstcharflags = reqcharflags = REQ_UNSET;
7115    
7116  /* Accumulate the length for use in the pre-compile phase. Start with the  /* Accumulate the length for use in the pre-compile phase. Start with the
7117  length of the BRA and KET and any extra bytes that are required at the  length of the BRA and KET and any extra bytes that are required at the
# Line 7107  for (;;) Line 7171  for (;;)
7171    into the length. */    into the length. */
7172    
7173    if (!compile_branch(&options, &code, &ptr, errorcodeptr, &branchfirstchar,    if (!compile_branch(&options, &code, &ptr, errorcodeptr, &branchfirstchar,
7174          &branchreqchar, &bc, cond_depth, cd,          &branchfirstcharflags, &branchreqchar, &branchreqcharflags, &bc,
7175          (lengthptr == NULL)? NULL : &length))          cond_depth, cd, (lengthptr == NULL)? NULL : &length))
7176      {      {
7177      *ptrptr = ptr;      *ptrptr = ptr;
7178      return FALSE;      return FALSE;
# Line 7129  for (;;) Line 7193  for (;;)
7193      if (*last_branch != OP_ALT)      if (*last_branch != OP_ALT)
7194        {        {
7195        firstchar = branchfirstchar;        firstchar = branchfirstchar;
7196          firstcharflags = branchfirstcharflags;
7197        reqchar = branchreqchar;        reqchar = branchreqchar;
7198          reqcharflags = branchreqcharflags;
7199        }        }
7200    
7201      /* If this is not the first branch, the first char and reqchar have to      /* If this is not the first branch, the first char and reqchar have to
# Line 7143  for (;;) Line 7209  for (;;)
7209        we have to abandon the firstchar for the regex, but if there was        we have to abandon the firstchar for the regex, but if there was
7210        previously no reqchar, it takes on the value of the old firstchar. */        previously no reqchar, it takes on the value of the old firstchar. */
7211    
7212        if (firstchar >= 0 && firstchar != branchfirstchar)        if (firstcharflags >= 0 &&
7213              (firstcharflags != branchfirstcharflags || firstchar != branchfirstchar))
7214          {          {
7215          if (reqchar < 0) reqchar = firstchar;          if (reqcharflags < 0)
7216          firstchar = REQ_NONE;            {
7217              reqchar = firstchar;
7218              reqcharflags = firstcharflags;
7219              }
7220            firstcharflags = REQ_NONE;
7221          }          }
7222    
7223        /* If we (now or from before) have no firstchar, a firstchar from the        /* If we (now or from before) have no firstchar, a firstchar from the
7224        branch becomes a reqchar if there isn't a branch reqchar. */        branch becomes a reqchar if there isn't a branch reqchar. */
7225    
7226        if (firstchar < 0 && branchfirstchar >= 0 && branchreqchar < 0)        if (firstcharflags < 0 && branchfirstcharflags >= 0 && branchreqcharflags < 0)
7227            branchreqchar = branchfirstchar;          {
7228            branchreqchar = branchfirstchar;
7229            branchreqcharflags = branchfirstcharflags;
7230            }
7231    
7232        /* Now ensure that the reqchars match */        /* Now ensure that the reqchars match */
7233    
7234        if ((reqchar & ~REQ_VARY) != (branchreqchar & ~REQ_VARY))        if (((reqcharflags & ~REQ_VARY) != (branchreqcharflags & ~REQ_VARY)) ||
7235          reqchar = REQ_NONE;            reqchar != branchreqchar)
7236        else reqchar |= branchreqchar;   /* To "or" REQ_VARY */          reqcharflags = REQ_NONE;
7237          else
7238            {
7239            reqchar = branchreqchar;
7240            reqcharflags |= branchreqcharflags; /* To "or" REQ_VARY */
7241            }
7242        }        }
7243    
7244      /* If lookbehind, check that this branch matches a fixed-length string, and      /* If lookbehind, check that this branch matches a fixed-length string, and
# Line 7255  for (;;) Line 7334  for (;;)
7334      *codeptr = code;      *codeptr = code;
7335      *ptrptr = ptr;      *ptrptr = ptr;
7336      *firstcharptr = firstchar;      *firstcharptr = firstchar;
7337        *firstcharflagsptr = firstcharflags;
7338      *reqcharptr = reqchar;      *reqcharptr = reqchar;
7339        *reqcharflagsptr = reqcharflags;
7340      if (lengthptr != NULL)      if (lengthptr != NULL)
7341        {        {
7342        if (OFLOW_MAX - *lengthptr < length)        if (OFLOW_MAX - *lengthptr < length)
# Line 7542  we return that char, otherwise -1. Line 7623  we return that char, otherwise -1.
7623    
7624  Arguments:  Arguments:
7625    code       points to start of expression (the bracket)    code       points to start of expression (the bracket)
7626      flags       points to the first char flags, or to REQ_NONE
7627    inassert   TRUE if in an assertion    inassert   TRUE if in an assertion
7628    
7629  Returns:     -1 or the fixed first char  Returns:     the fixed first char, or 0 with REQ_NONE in flags
7630  */  */
7631    
7632  static int  static pcre_uint32
7633  find_firstassertedchar(const pcre_uchar *code, BOOL inassert)  find_firstassertedchar(const pcre_uchar *code, pcre_int32 *flags,
7634      BOOL inassert)
7635  {  {
7636  register int c = -1;  register pcre_uint32 c = 0;
7637    int cflags = REQ_NONE;
7638    
7639    *flags = REQ_NONE;
7640  do {  do {
7641     int d;     pcre_uint32 d;
7642       int dflags;
7643     int xl = (*code == OP_CBRA || *code == OP_SCBRA ||     int xl = (*code == OP_CBRA || *code == OP_SCBRA ||
7644               *code == OP_CBRAPOS || *code == OP_SCBRAPOS)? IMM2_SIZE:0;               *code == OP_CBRAPOS || *code == OP_SCBRAPOS)? IMM2_SIZE:0;
7645     const pcre_uchar *scode = first_significant_code(code + 1+LINK_SIZE + xl,     const pcre_uchar *scode = first_significant_code(code + 1+LINK_SIZE + xl,
7646       TRUE);       TRUE);
7647     register int op = *scode;     register pcre_uchar op = *scode;
7648    
7649     switch(op)     switch(op)
7650       {       {
7651       default:       default:
7652       return -1;       return 0;
7653    
7654       case OP_BRA:       case OP_BRA:
7655       case OP_BRAPOS:       case OP_BRAPOS:
# Line 7574  do { Line 7661  do {
7661       case OP_ONCE:       case OP_ONCE:
7662       case OP_ONCE_NC:       case OP_ONCE_NC:
7663       case OP_COND:       case OP_COND:
7664       if ((d = find_firstassertedchar(scode, op == OP_ASSERT)) < 0)       d = find_firstassertedchar(scode, &dflags, op == OP_ASSERT);
7665         return -1;       if (dflags < 0)
7666       if (c < 0) c = d; else if (c != d) return -1;         return 0;
7667         if (cflags < 0) { c = d; cflags = dflags; } else if (c != d || cflags != dflags) return 0;
7668       break;       break;
7669    
7670       case OP_EXACT:       case OP_EXACT:
# Line 7587  do { Line 7675  do {
7675       case OP_PLUS:       case OP_PLUS:
7676       case OP_MINPLUS:       case OP_MINPLUS:
7677       case OP_POSPLUS:       case OP_POSPLUS:
7678       if (!inassert) return -1;       if (!inassert) return 0;
7679       if (c < 0) c = scode[1];       if (cflags < 0) { c = scode[1]; cflags = 0; }
7680         else if (c != scode[1]) return -1;         else if (c != scode[1]) return 0;
7681       break;       break;
7682    
7683       case OP_EXACTI:       case OP_EXACTI:
# Line 7600  do { Line 7688  do {
7688       case OP_PLUSI:       case OP_PLUSI:
7689       case OP_MINPLUSI:       case OP_MINPLUSI:
7690       case OP_POSPLUSI:       case OP_POSPLUSI:
7691       if (!inassert) return -1;       if (!inassert) return 0;
7692       if (c < 0) c = scode[1] | REQ_CASELESS;       if (cflags < 0) { c = scode[1]; cflags = REQ_CASELESS; }
7693         else if (c != scode[1]) return -1;         else if (c != scode[1]) return 0;
7694       break;       break;
7695       }       }
7696    
7697     code += GET(code, 1);     code += GET(code, 1);
7698     }     }
7699  while (*code == OP_ALT);  while (*code == OP_ALT);
7700    
7701    *flags = cflags;
7702  return c;  return c;
7703  }  }
7704    
# Line 7676  pcre32_compile2(PCRE_SPTR32 pattern, int Line 7766  pcre32_compile2(PCRE_SPTR32 pattern, int
7766  {  {
7767  REAL_PCRE *re;  REAL_PCRE *re;
7768  int length = 1;  /* For final END opcode */  int length = 1;  /* For final END opcode */
7769  pcre_int32 firstchar, reqchar;  pcre_uint32 firstchar, reqchar;
7770    pcre_int32 firstcharflags, reqcharflags;
7771  int newline;  int newline;
7772  int errorcode = 0;  int errorcode = 0;
7773  int skipatstart = 0;  int skipatstart = 0;
# Line 7926  ptr += skipatstart; Line 8017  ptr += skipatstart;
8017  code = cworkspace;  code = cworkspace;
8018  *code = OP_BRA;  *code = OP_BRA;
8019  (void)compile_regex(cd->external_options, &code, &ptr, &errorcode, FALSE,  (void)compile_regex(cd->external_options, &code, &ptr, &errorcode, FALSE,
8020    FALSE, 0, 0, &firstchar, &reqchar, NULL, cd, &length);    FALSE, 0, 0, &firstchar, &firstcharflags, &reqchar, &reqcharflags, NULL,
8021      cd, &length);
8022  if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;  if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;
8023    
8024  DPRINTF(("end pre-compile: length=%d workspace=%d\n", length,  DPRINTF(("end pre-compile: length=%d workspace=%d\n", length,
# Line 8004  ptr = (const pcre_uchar *)pattern + skip Line 8096  ptr = (const pcre_uchar *)pattern + skip
8096  code = (pcre_uchar *)codestart;  code = (pcre_uchar *)codestart;
8097  *code = OP_BRA;  *code = OP_BRA;
8098  (void)compile_regex(re->options, &code, &ptr, &errorcode, FALSE, FALSE, 0, 0,  (void)compile_regex(re->options, &code, &ptr, &errorcode, FALSE, FALSE, 0, 0,
8099    &firstchar, &reqchar, NULL, cd, NULL);    &firstchar, &firstcharflags, &reqchar, &reqcharflags, NULL, cd, NULL);
8100  re->top_bracket = cd->bracount;  re->top_bracket = cd->bracount;
8101  re->top_backref = cd->top_backref;  re->top_backref = cd->top_backref;
8102  re->max_lookbehind = cd->max_lookbehind;  re->max_lookbehind = cd->max_lookbehind;
8103  re->flags = cd->external_flags | PCRE_MODE;  re->flags = cd->external_flags | PCRE_MODE;
8104    
8105  if (cd->had_accept) reqchar = REQ_NONE;   /* Must disable after (*ACCEPT) */  if (cd->had_accept)
8106      {
8107      reqchar = 0;              /* Must disable after (*ACCEPT) */
8108      reqcharflags = REQ_NONE;
8109      }
8110    
8111  /* If not reached end of pattern on success, there's an excess bracket. */  /* If not reached end of pattern on success, there's an excess bracket. */
8112    
# Line 8060  if (errorcode == 0 && re->top_backref > Line 8156  if (errorcode == 0 && re->top_backref >
8156    
8157  /* If there were any lookbehind assertions that contained OP_RECURSE  /* If there were any lookbehind assertions that contained OP_RECURSE
8158  (recursions or subroutine calls), a flag is set for them to be checked here,  (recursions or subroutine calls), a flag is set for them to be checked here,
8159  because they may contain forward references. Actual recursions can't be fixed  because they may contain forward references. Actual recursions cannot be fixed
8160  length, but subroutine calls can. It is done like this so that those without  length, but subroutine calls can. It is done like this so that those without
8161  OP_RECURSE that are not fixed length get a diagnosic with a useful offset. The  OP_RECURSE that are not fixed length get a diagnosic with a useful offset. The
8162  exceptional ones forgo this. We scan the pattern to check that they are fixed  exceptional ones forgo this. We scan the pattern to check that they are fixed
# Line 8131  if ((re->options & PCRE_ANCHORED) == 0) Line 8227  if ((re->options & PCRE_ANCHORED) == 0)
8227    if (is_anchored(codestart, 0, cd, 0)) re->options |= PCRE_ANCHORED;    if (is_anchored(codestart, 0, cd, 0)) re->options |= PCRE_ANCHORED;
8228    else    else
8229      {      {
8230      if (firstchar < 0)      if (firstcharflags < 0)
8231        firstchar = find_firstassertedchar(codestart, FALSE);        firstchar = find_firstassertedchar(codestart, &firstcharflags, FALSE);
8232      if (firstchar >= 0)   /* Remove caseless flag for non-caseable chars */      if (firstcharflags >= 0)   /* Remove caseless flag for non-caseable chars */
8233        {        {
8234  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
8235        re->first_char = firstchar & 0xff;        re->first_char = firstchar & 0xff;
8236  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
8237        re->first_char = firstchar & 0xffff;        re->first_char = firstchar & 0xffff;
8238  #elif defined COMPILE_PCRE32  #elif defined COMPILE_PCRE32
8239        re->first_char = firstchar & ~REQ_MASK;        re->first_char = firstchar;
8240  #endif  #endif
8241        if ((firstchar & REQ_CASELESS) != 0)        if ((firstcharflags & REQ_CASELESS) != 0)
8242          {          {
8243  #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)  #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)
8244          /* We ignore non-ASCII first chars in 8 bit mode. */          /* We ignore non-ASCII first chars in 8 bit mode. */
# Line 8174  if ((re->options & PCRE_ANCHORED) == 0) Line 8270  if ((re->options & PCRE_ANCHORED) == 0)
8270  variable length item in the regex. Remove the caseless flag for non-caseable  variable length item in the regex. Remove the caseless flag for non-caseable
8271  bytes. */  bytes. */
8272    
8273  if (reqchar >= 0 &&  if (reqcharflags >= 0 &&
8274       ((re->options & PCRE_ANCHORED) == 0 || (reqchar & REQ_VARY) != 0))       ((re->options & PCRE_ANCHORED) == 0 || (reqcharflags & REQ_VARY) != 0))
8275    {    {
8276  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
8277    re->req_char = reqchar & 0xff;    re->req_char = reqchar & 0xff;
8278  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
8279    re->req_char = reqchar & 0xffff;    re->req_char = reqchar & 0xffff;
8280  #elif defined COMPILE_PCRE32  #elif defined COMPILE_PCRE32
8281    re->req_char = reqchar & ~REQ_MASK;    re->req_char = reqchar;
8282  #endif  #endif
8283    if ((reqchar & REQ_CASELESS) != 0)    if ((reqcharflags & REQ_CASELESS) != 0)
8284      {      {
8285  #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)  #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)
8286      /* We ignore non-ASCII first chars in 8 bit mode. */      /* We ignore non-ASCII first chars in 8 bit mode. */

Legend:
Removed from v.1072  
changed lines
  Added in v.1124

  ViewVC Help
Powered by ViewVC 1.1.5