/[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 1120 by chpe, Tue Oct 16 15:57:38 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 3251  if (escape == 0) Line 3253  if (escape == 0)
3253    
3254  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3255      case OP_PROP:      case OP_PROP:
3256      return check_char_prop(next, previous[0], previous[1], FALSE);      return check_char_prop(next, (int)previous[0], (int)previous[1], FALSE);
3257    
3258      case OP_NOTPROP:      case OP_NOTPROP:
3259      return check_char_prop(next, previous[0], previous[1], TRUE);      return check_char_prop(next, (int)previous[0], (int)previous[1], TRUE);
3260  #endif  #endif
3261    
3262      default:      default:
# Line 3666  Arguments: Line 3668  Arguments:
3668    codeptr        points to the pointer to the current code point    codeptr        points to the pointer to the current code point
3669    ptrptr         points to the current pattern pointer    ptrptr         points to the current pattern pointer
3670    errorcodeptr   points to error code variable    errorcodeptr   points to error code variable
3671    firstcharptr   set to initial literal character, or < 0 (REQ_UNSET, REQ_NONE)    firstcharptr    place to put the first required character
3672    reqcharptr     set to the last literal character required, else < 0    firstcharflagsptr place to put the first character flags, or a negative number
3673      reqcharptr     place to put the last required character
3674      reqcharflagsptr place to put the last required character flags, or a negative number
3675    bcptr          points to current branch chain    bcptr          points to current branch chain
3676    cond_depth     conditional nesting depth    cond_depth     conditional nesting depth
3677    cd             contains pointers to tables etc.    cd             contains pointers to tables etc.
# Line 3680  Returns:         TRUE on success Line 3684  Returns:         TRUE on success
3684    
3685  static BOOL  static BOOL
3686  compile_branch(int *optionsptr, pcre_uchar **codeptr,  compile_branch(int *optionsptr, pcre_uchar **codeptr,
3687    const pcre_uchar **ptrptr, int *errorcodeptr, pcre_int32 *firstcharptr,    const pcre_uchar **ptrptr, int *errorcodeptr,
3688    pcre_int32 *reqcharptr, branch_chain *bcptr, int cond_depth,    pcre_uint32 *firstcharptr, pcre_int32 *firstcharflagsptr,
3689      pcre_uint32 *reqcharptr, pcre_int32 *reqcharflagsptr,
3690      branch_chain *bcptr, int cond_depth,
3691    compile_data *cd, int *lengthptr)    compile_data *cd, int *lengthptr)
3692  {  {
3693  int repeat_type, op_type;  int repeat_type, op_type;
3694  int repeat_min = 0, repeat_max = 0;      /* To please picky compilers */  int repeat_min = 0, repeat_max = 0;      /* To please picky compilers */
3695  int bravalue = 0;  int bravalue = 0;
3696  int greedy_default, greedy_non_default;  int greedy_default, greedy_non_default;
3697  pcre_int32 firstchar, reqchar;  pcre_uint32 firstchar, reqchar;
3698  pcre_int32 zeroreqchar, zerofirstchar;  pcre_int32 firstcharflags, reqcharflags;
3699    pcre_uint32 zeroreqchar, zerofirstchar;
3700    pcre_int32 zeroreqcharflags, zerofirstcharflags;
3701  pcre_int32 req_caseopt, reqvary, tempreqvary;  pcre_int32 req_caseopt, reqvary, tempreqvary;
3702  int options = *optionsptr;               /* May change dynamically */  int options = *optionsptr;               /* May change dynamically */
3703  int after_manual_callout = 0;  int after_manual_callout = 0;
# Line 3717  dynamically as we process the pattern. * Line 3725  dynamically as we process the pattern. *
3725  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3726  /* PCRE_UTF[16|32] have the same value as PCRE_UTF8. */  /* PCRE_UTF[16|32] have the same value as PCRE_UTF8. */
3727  BOOL utf = (options & PCRE_UTF8) != 0;  BOOL utf = (options & PCRE_UTF8) != 0;
3728    #ifndef COMPILE_PCRE32
3729  pcre_uchar utf_chars[6];  pcre_uchar utf_chars[6];
3730    #endif
3731  #else  #else
3732  BOOL utf = FALSE;  BOOL utf = FALSE;
3733  #endif  #endif
# Line 3752  to take the zero repeat into account. Th Line 3762  to take the zero repeat into account. Th
3762  zerofirstbyte and zeroreqchar when such a repeat is encountered. The individual  zerofirstbyte and zeroreqchar when such a repeat is encountered. The individual
3763  item types that can be repeated set these backoff variables appropriately. */  item types that can be repeated set these backoff variables appropriately. */
3764    
3765  firstchar = reqchar = zerofirstchar = zeroreqchar = REQ_UNSET;  firstchar = reqchar = zerofirstchar = zeroreqchar = 0;
3766    firstcharflags = reqcharflags = zerofirstcharflags = zeroreqcharflags = REQ_UNSET;
3767    
3768  /* The variable req_caseopt contains either the REQ_CASELESS value  /* The variable req_caseopt contains either the REQ_CASELESS value
3769  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 3789  for (;; ptr++)
3789    int recno;    int recno;
3790    int refsign;    int refsign;
3791    int skipbytes;    int skipbytes;
3792    int subreqchar;    pcre_uint32 subreqchar, subfirstchar;
3793    int subfirstchar;    pcre_int32 subreqcharflags, subfirstcharflags;
3794    int terminator;    int terminator;
3795    int mclength;    int mclength;
3796    int tempbracount;    int tempbracount;
3797    int ec; // FIXMEchpe pcre_uint32    pcre_uint32 ec;
3798    pcre_uchar mcbuffer[8];    pcre_uchar mcbuffer[8];
3799    
3800    /* Get next character in the pattern */    /* Get next character in the pattern */
# Line 3946  for (;; ptr++) Line 3957  for (;; ptr++)
3957      case CHAR_VERTICAL_LINE:       /* or | or ) */      case CHAR_VERTICAL_LINE:       /* or | or ) */
3958      case CHAR_RIGHT_PARENTHESIS:      case CHAR_RIGHT_PARENTHESIS:
3959      *firstcharptr = firstchar;      *firstcharptr = firstchar;
3960        *firstcharflagsptr = firstcharflags;
3961      *reqcharptr = reqchar;      *reqcharptr = reqchar;
3962        *reqcharflagsptr = reqcharflags;
3963      *codeptr = code;      *codeptr = code;
3964      *ptrptr = ptr;      *ptrptr = ptr;
3965      if (lengthptr != NULL)      if (lengthptr != NULL)
# Line 3970  for (;; ptr++) Line 3983  for (;; ptr++)
3983      previous = NULL;      previous = NULL;
3984      if ((options & PCRE_MULTILINE) != 0)      if ((options & PCRE_MULTILINE) != 0)
3985        {        {
3986        if (firstchar == REQ_UNSET) firstchar = REQ_NONE;        if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
3987        *code++ = OP_CIRCM;        *code++ = OP_CIRCM;
3988        }        }
3989      else *code++ = OP_CIRC;      else *code++ = OP_CIRC;
# Line 3985  for (;; ptr++) Line 3998  for (;; ptr++)
3998      repeats. The value of reqchar doesn't change either. */      repeats. The value of reqchar doesn't change either. */
3999    
4000      case CHAR_DOT:      case CHAR_DOT:
4001      if (firstchar == REQ_UNSET) firstchar = REQ_NONE;      if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
4002      zerofirstchar = firstchar;      zerofirstchar = firstchar;
4003        zerofirstcharflags = firstcharflags;
4004      zeroreqchar = reqchar;      zeroreqchar = reqchar;
4005        zeroreqcharflags = reqcharflags;
4006      previous = code;      previous = code;
4007      *code++ = ((options & PCRE_DOTALL) != 0)? OP_ALLANY: OP_ANY;      *code++ = ((options & PCRE_DOTALL) != 0)? OP_ALLANY: OP_ANY;
4008      break;      break;
# Line 4061  for (;; ptr++) Line 4076  for (;; ptr++)
4076          (cd->external_options & PCRE_JAVASCRIPT_COMPAT) != 0)          (cd->external_options & PCRE_JAVASCRIPT_COMPAT) != 0)
4077        {        {
4078        *code++ = negate_class? OP_ALLANY : OP_FAIL;        *code++ = negate_class? OP_ALLANY : OP_FAIL;
4079        if (firstchar == REQ_UNSET) firstchar = REQ_NONE;        if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
4080        zerofirstchar = firstchar;        zerofirstchar = firstchar;
4081          zerofirstcharflags = firstcharflags;
4082        break;        break;
4083        }        }
4084    
# Line 4101  for (;; ptr++) Line 4117  for (;; ptr++)
4117        {        {
4118        const pcre_uchar *oldptr;        const pcre_uchar *oldptr;
4119    
4120  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
4121        if (utf && HAS_EXTRALEN(c))        if (utf && HAS_EXTRALEN(c))
4122          {                           /* Braces are required because the */          {                           /* Braces are required because the */
4123          GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */          GETCHARLEN(c, ptr, ptr);    /* macro generates multiple statements */
# Line 4416  for (;; ptr++) Line 4432  for (;; ptr++)
4432    
4433        if (!inescq && ptr[1] == CHAR_MINUS)        if (!inescq && ptr[1] == CHAR_MINUS)
4434          {          {
4435          int d;          pcre_uint32 d;
4436          ptr += 2;          ptr += 2;
4437          while (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_E) ptr += 2;          while (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_E) ptr += 2;
4438    
# Line 4522  for (;; ptr++) Line 4538  for (;; ptr++)
4538          {          {
4539          ptr++;          ptr++;
4540          zeroreqchar = reqchar;          zeroreqchar = reqchar;
4541            zeroreqcharflags = reqcharflags;
4542    
4543          if (negate_class)          if (negate_class)
4544            {            {
4545  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
             // FIXMEchpe pcreuint32?  
4546            int d;            int d;
4547  #endif  #endif
4548            if (firstchar == REQ_UNSET) firstchar = REQ_NONE;            if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
4549            zerofirstchar = firstchar;            zerofirstchar = firstchar;
4550              zerofirstcharflags = firstcharflags;
4551    
4552            /* For caseless UTF-8 mode when UCP support is available, check            /* For caseless UTF-8 mode when UCP support is available, check
4553            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 4635  for (;; ptr++)
4635      setting, whatever the repeat count. Any reqchar setting must remain      setting, whatever the repeat count. Any reqchar setting must remain
4636      unchanged after any kind of repeat. */      unchanged after any kind of repeat. */
4637    
4638      if (firstchar == REQ_UNSET) firstchar = REQ_NONE;      if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
4639      zerofirstchar = firstchar;      zerofirstchar = firstchar;
4640        zerofirstcharflags = firstcharflags;
4641      zeroreqchar = reqchar;      zeroreqchar = reqchar;
4642        zeroreqcharflags = reqcharflags;
4643    
4644      /* If there are characters with values > 255, we have to compile an      /* If there are characters with values > 255, we have to compile an
4645      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 4734  for (;; ptr++)
4734      if (repeat_min == 0)      if (repeat_min == 0)
4735        {        {
4736        firstchar = zerofirstchar;    /* Adjust for zero repeat */        firstchar = zerofirstchar;    /* Adjust for zero repeat */
4737          firstcharflags = zerofirstcharflags;
4738        reqchar = zeroreqchar;        /* Ditto */        reqchar = zeroreqchar;        /* Ditto */
4739          reqcharflags = zeroreqcharflags;
4740        }        }
4741    
4742      /* Remember whether this is a variable length repeat */      /* Remember whether this is a variable length repeat */
# Line 4818  for (;; ptr++) Line 4839  for (;; ptr++)
4839          {          {
4840          c = code[-1];          c = code[-1];
4841          if (*previous <= OP_CHARI && repeat_min > 1)          if (*previous <= OP_CHARI && repeat_min > 1)
4842            reqchar = c | req_caseopt | cd->req_varyopt;            {
4843              reqchar = c;
4844              reqcharflags = req_caseopt | cd->req_varyopt;
4845              }
4846          }          }
4847    
4848        /* 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 5224  for (;; ptr++)
5224    
5225            else            else
5226              {              {
5227              if (groupsetfirstchar && reqchar < 0) reqchar = firstchar;              if (groupsetfirstchar && reqcharflags < 0)
5228                  {
5229                  reqchar = firstchar;
5230                  reqcharflags = firstcharflags;
5231                  }
5232    
5233              for (i = 1; i < repeat_min; i++)              for (i = 1; i < repeat_min; i++)
5234                {                {
# Line 5479  for (;; ptr++) Line 5507  for (;; ptr++)
5507        else if (*tempcode == OP_EXACT || *tempcode == OP_NOTEXACT)        else if (*tempcode == OP_EXACT || *tempcode == OP_NOTEXACT)
5508          {          {
5509          tempcode += PRIV(OP_lengths)[*tempcode];          tempcode += PRIV(OP_lengths)[*tempcode];
5510  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
5511          if (utf && HAS_EXTRALEN(tempcode[-1]))          if (utf && HAS_EXTRALEN(tempcode[-1]))
5512            tempcode += GET_EXTRALEN(tempcode[-1]);            tempcode += GET_EXTRALEN(tempcode[-1]);
5513  #endif  #endif
# Line 5620  for (;; ptr++) Line 5648  for (;; ptr++)
5648                (cd->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;                (cd->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;
5649    
5650              /* Do not set firstchar after *ACCEPT */              /* Do not set firstchar after *ACCEPT */
5651              if (firstchar == REQ_UNSET) firstchar = REQ_NONE;              if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
5652              }              }
5653    
5654            /* Handle other cases with/without an argument */            /* Handle other cases with/without an argument */
# Line 5786  for (;; ptr++) Line 5814  for (;; ptr++)
5814          while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0)          while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0)
5815            {            {
5816            if (recno >= 0)            if (recno >= 0)
5817              recno = (IS_DIGIT(*ptr))? recno * 10 + *ptr - CHAR_0 : -1;              recno = (IS_DIGIT(*ptr))? recno * 10 + (int)(*ptr - CHAR_0) : -1;
5818            ptr++;            ptr++;
5819            }            }
5820          namelen = (int)(ptr - name);          namelen = (int)(ptr - name);
# Line 6383  for (;; ptr++) Line 6411  for (;; ptr++)
6411    
6412          /* Can't determine a first byte now */          /* Can't determine a first byte now */
6413    
6414          if (firstchar == REQ_UNSET) firstchar = REQ_NONE;          if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
6415          continue;          continue;
6416    
6417    
# Line 6517  for (;; ptr++) Line 6545  for (;; ptr++)
6545           cond_depth +           cond_depth +
6546             ((bravalue == OP_COND)?1:0),   /* Depth of condition subpatterns */             ((bravalue == OP_COND)?1:0),   /* Depth of condition subpatterns */
6547           &subfirstchar,                   /* For possible first char */           &subfirstchar,                   /* For possible first char */
6548             &subfirstcharflags,
6549           &subreqchar,                     /* For possible last char */           &subreqchar,                     /* For possible last char */
6550             &subreqcharflags,
6551           bcptr,                           /* Current branch chain */           bcptr,                           /* Current branch chain */
6552           cd,                              /* Tables block */           cd,                              /* Tables block */
6553           (lengthptr == NULL)? NULL :      /* Actual compile phase */           (lengthptr == NULL)? NULL :      /* Actual compile phase */
# Line 6578  for (;; ptr++) Line 6608  for (;; ptr++)
6608            *errorcodeptr = ERR27;            *errorcodeptr = ERR27;
6609            goto FAILED;            goto FAILED;
6610            }            }
6611          if (condcount == 1) subfirstchar = subreqchar = REQ_NONE;          if (condcount == 1) subfirstcharflags = subreqcharflags = REQ_NONE;
6612          }          }
6613        }        }
6614    
# Line 6627  for (;; ptr++) Line 6657  for (;; ptr++)
6657      back off. */      back off. */
6658    
6659      zeroreqchar = reqchar;      zeroreqchar = reqchar;
6660        zeroreqcharflags = reqcharflags;
6661      zerofirstchar = firstchar;      zerofirstchar = firstchar;
6662        zerofirstcharflags = firstcharflags;
6663      groupsetfirstchar = FALSE;      groupsetfirstchar = FALSE;
6664    
6665      if (bravalue >= OP_ONCE)      if (bravalue >= OP_ONCE)
# Line 6638  for (;; ptr++) Line 6670  for (;; ptr++)
6670        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
6671        repeat forces firstchar to "none". */        repeat forces firstchar to "none". */
6672    
6673        if (firstchar == REQ_UNSET)        if (firstcharflags == REQ_UNSET)
6674          {          {
6675          if (subfirstchar >= 0)          if (subfirstcharflags >= 0)
6676            {            {
6677            firstchar = subfirstchar;            firstchar = subfirstchar;
6678              firstcharflags = subfirstcharflags;
6679            groupsetfirstchar = TRUE;            groupsetfirstchar = TRUE;
6680            }            }
6681          else firstchar = REQ_NONE;          else firstcharflags = REQ_NONE;
6682          zerofirstchar = REQ_NONE;          zerofirstcharflags = REQ_NONE;
6683          }          }
6684    
6685        /* If firstchar was previously set, convert the subpattern's firstchar        /* If firstchar was previously set, convert the subpattern's firstchar
6686        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
6687        existence beforehand. */        existence beforehand. */
6688    
6689        else if (subfirstchar >= 0 && subreqchar < 0)        else if (subfirstcharflags >= 0 && subreqcharflags < 0)
6690          subreqchar = subfirstchar | tempreqvary;          {
6691            subreqchar = subfirstchar;
6692            subreqcharflags = subfirstcharflags | tempreqvary;
6693            }
6694    
6695        /* 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
6696        really the first byte - see above), set it. */        really the first byte - see above), set it. */
6697    
6698        if (subreqchar >= 0) reqchar = subreqchar;        if (subreqcharflags >= 0)
6699            {
6700            reqchar = subreqchar;
6701            reqcharflags = subreqcharflags;
6702            }
6703        }        }
6704    
6705      /* 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 6710  for (;; ptr++)
6710      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
6711      firstchar, looking for an asserted first char. */      firstchar, looking for an asserted first char. */
6712    
6713      else if (bravalue == OP_ASSERT && subreqchar >= 0) reqchar = subreqchar;      else if (bravalue == OP_ASSERT && subreqcharflags >= 0)
6714          {
6715          reqchar = subreqchar;
6716          reqcharflags = subreqcharflags;
6717          }
6718      break;     /* End of processing '(' */      break;     /* End of processing '(' */
6719    
6720    
# Line 6706  for (;; ptr++) Line 6750  for (;; ptr++)
6750        /* For metasequences that actually match a character, we disable the        /* For metasequences that actually match a character, we disable the
6751        setting of a first character if it hasn't already been set. */        setting of a first character if it hasn't already been set. */
6752    
6753        if (firstchar == REQ_UNSET && escape > ESC_b && escape < ESC_Z)        if (firstcharflags == REQ_UNSET && escape > ESC_b && escape < ESC_Z)
6754          firstchar = REQ_NONE;          firstcharflags = REQ_NONE;
6755    
6756        /* 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. */
6757    
6758        zerofirstchar = firstchar;        zerofirstchar = firstchar;
6759          zerofirstcharflags = firstcharflags;
6760        zeroreqchar = reqchar;        zeroreqchar = reqchar;
6761          zeroreqcharflags = reqcharflags;
6762    
6763        /* \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'
6764        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 6848  for (;; ptr++)
6848          recno = -escape;          recno = -escape;
6849    
6850          HANDLE_REFERENCE:    /* Come here from named backref handling */          HANDLE_REFERENCE:    /* Come here from named backref handling */
6851          if (firstchar == REQ_UNSET) firstchar = REQ_NONE;          if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
6852          previous = code;          previous = code;
6853          *code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;          *code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
6854          PUT2INC(code, 0, recno);          PUT2INC(code, 0, recno);
# Line 6905  for (;; ptr++) Line 6951  for (;; ptr++)
6951      mclength = 1;      mclength = 1;
6952      mcbuffer[0] = c;      mcbuffer[0] = c;
6953    
6954  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #ifdef SUPPORT_UTF
6955      if (utf && HAS_EXTRALEN(c))      if (utf && HAS_EXTRALEN(c))
6956        ACROSSCHAR(TRUE, ptr[1], mcbuffer[mclength++] = *(++ptr));        ACROSSCHAR(TRUE, ptr[1], mcbuffer[mclength++] = *(++ptr));
6957  #endif  #endif
# Line 6929  for (;; ptr++) Line 6975  for (;; ptr++)
6975          *code++ = OP_PROP;          *code++ = OP_PROP;
6976          *code++ = PT_CLIST;          *code++ = PT_CLIST;
6977          *code++ = c;          *code++ = c;
6978          if (firstchar == REQ_UNSET) firstchar = zerofirstchar = REQ_NONE;          if (firstcharflags == REQ_UNSET) firstcharflags = zerofirstcharflags = REQ_NONE;
6979          break;          break;
6980          }          }
6981        }        }
# Line 6950  for (;; ptr++) Line 6996  for (;; ptr++)
6996      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
6997      repeat. */      repeat. */
6998    
6999      if (firstchar == REQ_UNSET)      if (firstcharflags == REQ_UNSET)
7000        {        {
7001        zerofirstchar = REQ_NONE;        zerofirstcharflags = REQ_NONE;
7002        zeroreqchar = reqchar;        zeroreqchar = reqchar;
7003          zeroreqcharflags = reqcharflags;
7004    
7005        /* 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
7006        only if it is not to be matched caselessly. */        only if it is not to be matched caselessly. */
# Line 6961  for (;; ptr++) Line 7008  for (;; ptr++)
7008        if (mclength == 1 || req_caseopt == 0)        if (mclength == 1 || req_caseopt == 0)
7009          {          {
7010          firstchar = mcbuffer[0] | req_caseopt;          firstchar = mcbuffer[0] | req_caseopt;
7011          if (mclength != 1) reqchar = code[-1] | cd->req_varyopt;          firstchar = mcbuffer[0];
7012            firstcharflags = req_caseopt;
7013    
7014            if (mclength != 1)
7015              {
7016              reqchar = code[-1];
7017              reqcharflags = cd->req_varyopt;
7018              }
7019          }          }
7020        else firstchar = reqchar = REQ_NONE;        else firstcharflags = reqcharflags = REQ_NONE;
7021        }        }
7022    
7023      /* 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 7026  for (;; ptr++)
7026      else      else
7027        {        {
7028        zerofirstchar = firstchar;        zerofirstchar = firstchar;
7029          zerofirstcharflags = firstcharflags;
7030        zeroreqchar = reqchar;        zeroreqchar = reqchar;
7031          zeroreqcharflags = reqcharflags;
7032        if (mclength == 1 || req_caseopt == 0)        if (mclength == 1 || req_caseopt == 0)
7033          reqchar = code[-1] | req_caseopt | cd->req_varyopt;          {
7034            reqchar = code[-1];
7035            reqcharflags = req_caseopt | cd->req_varyopt;
7036            }
7037        }        }
7038    
7039      break;            /* End of literal character handling */      break;            /* End of literal character handling */
# Line 6993  return FALSE; Line 7052  return FALSE;
7052    
7053    
7054    
   
7055  /*************************************************  /*************************************************
7056  *     Compile sequence of alternatives           *  *     Compile sequence of alternatives           *
7057  *************************************************/  *************************************************/
# Line 7014  Arguments: Line 7072  Arguments:
7072    reset_bracount TRUE to reset the count for each branch    reset_bracount TRUE to reset the count for each branch
7073    skipbytes      skip this many bytes at start (for brackets and OP_COND)    skipbytes      skip this many bytes at start (for brackets and OP_COND)
7074    cond_depth     depth of nesting for conditional subpatterns    cond_depth     depth of nesting for conditional subpatterns
7075    firstcharptr   place to put the first required character, or a negative number    firstcharptr    place to put the first required character
7076    reqcharptr     place to put the last required character, or a negative number    firstcharflagsptr place to put the first character flags, or a negative number
7077      reqcharptr     place to put the last required character
7078      reqcharflagsptr place to put the last required character flags, or a negative number
7079    bcptr          pointer to the chain of currently open branches    bcptr          pointer to the chain of currently open branches
7080    cd             points to the data block with tables pointers etc.    cd             points to the data block with tables pointers etc.
7081    lengthptr      NULL during the real compile phase    lengthptr      NULL during the real compile phase
# Line 7027  Returns:         TRUE on success Line 7087  Returns:         TRUE on success
7087  static BOOL  static BOOL
7088  compile_regex(int options, pcre_uchar **codeptr, const pcre_uchar **ptrptr,  compile_regex(int options, pcre_uchar **codeptr, const pcre_uchar **ptrptr,
7089    int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes,    int *errorcodeptr, BOOL lookbehind, BOOL reset_bracount, int skipbytes,
7090    int cond_depth, pcre_int32 *firstcharptr, pcre_int32 *reqcharptr,    int cond_depth,
7091      pcre_uint32 *firstcharptr, pcre_int32 *firstcharflagsptr,
7092      pcre_uint32 *reqcharptr, pcre_int32 *reqcharflagsptr,
7093    branch_chain *bcptr, compile_data *cd, int *lengthptr)    branch_chain *bcptr, compile_data *cd, int *lengthptr)
7094  {  {
7095  const pcre_uchar *ptr = *ptrptr;  const pcre_uchar *ptr = *ptrptr;
# Line 7037  pcre_uchar *start_bracket = code; Line 7099  pcre_uchar *start_bracket = code;
7099  pcre_uchar *reverse_count = NULL;  pcre_uchar *reverse_count = NULL;
7100  open_capitem capitem;  open_capitem capitem;
7101  int capnumber = 0;  int capnumber = 0;
7102  pcre_int32 firstchar, reqchar;  pcre_uint32 firstchar, reqchar;
7103  pcre_int32 branchfirstchar, branchreqchar;  pcre_int32 firstcharflags, reqcharflags;
7104    pcre_uint32 branchfirstchar, branchreqchar;
7105    pcre_int32 branchfirstcharflags, branchreqcharflags;
7106  int length;  int length;
7107  int orig_bracount;  int orig_bracount;
7108  int max_bracount;  int max_bracount;
# Line 7047  branch_chain bc; Line 7111  branch_chain bc;
7111  bc.outer = bcptr;  bc.outer = bcptr;
7112  bc.current_branch = code;  bc.current_branch = code;
7113    
7114  firstchar = reqchar = REQ_UNSET;  firstchar = reqchar = 0;
7115    firstcharflags = reqcharflags = REQ_UNSET;
7116    
7117  /* 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
7118  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 7172  for (;;)
7172    into the length. */    into the length. */
7173    
7174    if (!compile_branch(&options, &code, &ptr, errorcodeptr, &branchfirstchar,    if (!compile_branch(&options, &code, &ptr, errorcodeptr, &branchfirstchar,
7175          &branchreqchar, &bc, cond_depth, cd,          &branchfirstcharflags, &branchreqchar, &branchreqcharflags, &bc,
7176          (lengthptr == NULL)? NULL : &length))          cond_depth, cd, (lengthptr == NULL)? NULL : &length))
7177      {      {
7178      *ptrptr = ptr;      *ptrptr = ptr;
7179      return FALSE;      return FALSE;
# Line 7129  for (;;) Line 7194  for (;;)
7194      if (*last_branch != OP_ALT)      if (*last_branch != OP_ALT)
7195        {        {
7196        firstchar = branchfirstchar;        firstchar = branchfirstchar;
7197          firstcharflags = branchfirstcharflags;
7198        reqchar = branchreqchar;        reqchar = branchreqchar;
7199          reqcharflags = branchreqcharflags;
7200        }        }
7201    
7202      /* 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 7210  for (;;)
7210        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
7211        previously no reqchar, it takes on the value of the old firstchar. */        previously no reqchar, it takes on the value of the old firstchar. */
7212    
7213        if (firstchar >= 0 && firstchar != branchfirstchar)        if (firstcharflags >= 0 &&
7214              (firstcharflags != branchfirstcharflags || firstchar != branchfirstchar))
7215          {          {
7216          if (reqchar < 0) reqchar = firstchar;          if (reqcharflags < 0)
7217          firstchar = REQ_NONE;            {
7218              reqchar = firstchar;
7219              reqcharflags = firstcharflags;
7220              }
7221            firstcharflags = REQ_NONE;
7222          }          }
7223    
7224        /* 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
7225        branch becomes a reqchar if there isn't a branch reqchar. */        branch becomes a reqchar if there isn't a branch reqchar. */
7226    
7227        if (firstchar < 0 && branchfirstchar >= 0 && branchreqchar < 0)        if (firstcharflags < 0 && branchfirstcharflags >= 0 && branchreqcharflags < 0)
7228            branchreqchar = branchfirstchar;          {
7229            branchreqchar = branchfirstchar;
7230            branchreqcharflags = branchfirstcharflags;
7231            }
7232    
7233        /* Now ensure that the reqchars match */        /* Now ensure that the reqchars match */
7234    
7235        if ((reqchar & ~REQ_VARY) != (branchreqchar & ~REQ_VARY))        if (((reqcharflags & ~REQ_VARY) != (branchreqcharflags & ~REQ_VARY)) ||
7236          reqchar = REQ_NONE;            reqchar != branchreqchar)
7237        else reqchar |= branchreqchar;   /* To "or" REQ_VARY */          reqcharflags = REQ_NONE;
7238          else
7239            {
7240            reqchar = branchreqchar;
7241            reqcharflags |= branchreqcharflags; /* To "or" REQ_VARY */
7242            }
7243        }        }
7244    
7245      /* 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 7335  for (;;)
7335      *codeptr = code;      *codeptr = code;
7336      *ptrptr = ptr;      *ptrptr = ptr;
7337      *firstcharptr = firstchar;      *firstcharptr = firstchar;
7338        *firstcharflagsptr = firstcharflags;
7339      *reqcharptr = reqchar;      *reqcharptr = reqchar;
7340        *reqcharflagsptr = reqcharflags;
7341      if (lengthptr != NULL)      if (lengthptr != NULL)
7342        {        {
7343        if (OFLOW_MAX - *lengthptr < length)        if (OFLOW_MAX - *lengthptr < length)
# Line 7542  we return that char, otherwise -1. Line 7624  we return that char, otherwise -1.
7624    
7625  Arguments:  Arguments:
7626    code       points to start of expression (the bracket)    code       points to start of expression (the bracket)
7627      flags       points to the first char flags, or to REQ_NONE
7628    inassert   TRUE if in an assertion    inassert   TRUE if in an assertion
7629    
7630  Returns:     -1 or the fixed first char  Returns:     the fixed first char, or 0 with REQ_NONE in flags
7631  */  */
7632    
7633  static int  static pcre_uint32
7634  find_firstassertedchar(const pcre_uchar *code, BOOL inassert)  find_firstassertedchar(const pcre_uchar *code, pcre_int32 *flags,
7635      BOOL inassert)
7636  {  {
7637  register int c = -1;  register pcre_uint32 c = 0;
7638    int cflags = REQ_NONE;
7639    
7640    *flags = REQ_NONE;
7641  do {  do {
7642     int d;     pcre_uint32 d;
7643       int dflags;
7644     int xl = (*code == OP_CBRA || *code == OP_SCBRA ||     int xl = (*code == OP_CBRA || *code == OP_SCBRA ||
7645               *code == OP_CBRAPOS || *code == OP_SCBRAPOS)? IMM2_SIZE:0;               *code == OP_CBRAPOS || *code == OP_SCBRAPOS)? IMM2_SIZE:0;
7646     const pcre_uchar *scode = first_significant_code(code + 1+LINK_SIZE + xl,     const pcre_uchar *scode = first_significant_code(code + 1+LINK_SIZE + xl,
7647       TRUE);       TRUE);
7648     register int op = *scode;     register pcre_uchar op = *scode;
7649    
7650     switch(op)     switch(op)
7651       {       {
7652       default:       default:
7653       return -1;       return 0;
7654    
7655       case OP_BRA:       case OP_BRA:
7656       case OP_BRAPOS:       case OP_BRAPOS:
# Line 7574  do { Line 7662  do {
7662       case OP_ONCE:       case OP_ONCE:
7663       case OP_ONCE_NC:       case OP_ONCE_NC:
7664       case OP_COND:       case OP_COND:
7665       if ((d = find_firstassertedchar(scode, op == OP_ASSERT)) < 0)       d = find_firstassertedchar(scode, &dflags, op == OP_ASSERT);
7666         return -1;       if (dflags < 0)
7667       if (c < 0) c = d; else if (c != d) return -1;         return 0;
7668         if (cflags < 0) { c = d; cflags = dflags; } else if (c != d || cflags != dflags) return 0;
7669       break;       break;
7670    
7671       case OP_EXACT:       case OP_EXACT:
# Line 7587  do { Line 7676  do {
7676       case OP_PLUS:       case OP_PLUS:
7677       case OP_MINPLUS:       case OP_MINPLUS:
7678       case OP_POSPLUS:       case OP_POSPLUS:
7679       if (!inassert) return -1;       if (!inassert) return 0;
7680       if (c < 0) c = scode[1];       if (cflags < 0) { c = scode[1]; cflags = 0; }
7681         else if (c != scode[1]) return -1;         else if (c != scode[1]) return 0;
7682       break;       break;
7683    
7684       case OP_EXACTI:       case OP_EXACTI:
# Line 7600  do { Line 7689  do {
7689       case OP_PLUSI:       case OP_PLUSI:
7690       case OP_MINPLUSI:       case OP_MINPLUSI:
7691       case OP_POSPLUSI:       case OP_POSPLUSI:
7692       if (!inassert) return -1;       if (!inassert) return 0;
7693       if (c < 0) c = scode[1] | REQ_CASELESS;       if (cflags < 0) { c = scode[1]; cflags = REQ_CASELESS; }
7694         else if (c != scode[1]) return -1;         else if (c != scode[1]) return 0;
7695       break;       break;
7696       }       }
7697    
7698     code += GET(code, 1);     code += GET(code, 1);
7699     }     }
7700  while (*code == OP_ALT);  while (*code == OP_ALT);
7701    
7702    *flags = cflags;
7703  return c;  return c;
7704  }  }
7705    
# Line 7676  pcre32_compile2(PCRE_SPTR32 pattern, int Line 7767  pcre32_compile2(PCRE_SPTR32 pattern, int
7767  {  {
7768  REAL_PCRE *re;  REAL_PCRE *re;
7769  int length = 1;  /* For final END opcode */  int length = 1;  /* For final END opcode */
7770  pcre_int32 firstchar, reqchar;  pcre_uint32 firstchar, reqchar;
7771    pcre_int32 firstcharflags, reqcharflags;
7772  int newline;  int newline;
7773  int errorcode = 0;  int errorcode = 0;
7774  int skipatstart = 0;  int skipatstart = 0;
# Line 7926  ptr += skipatstart; Line 8018  ptr += skipatstart;
8018  code = cworkspace;  code = cworkspace;
8019  *code = OP_BRA;  *code = OP_BRA;
8020  (void)compile_regex(cd->external_options, &code, &ptr, &errorcode, FALSE,  (void)compile_regex(cd->external_options, &code, &ptr, &errorcode, FALSE,
8021    FALSE, 0, 0, &firstchar, &reqchar, NULL, cd, &length);    FALSE, 0, 0, &firstchar, &firstcharflags, &reqchar, &reqcharflags, NULL,
8022      cd, &length);
8023  if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;  if (errorcode != 0) goto PCRE_EARLY_ERROR_RETURN;
8024    
8025  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 8097  ptr = (const pcre_uchar *)pattern + skip
8097  code = (pcre_uchar *)codestart;  code = (pcre_uchar *)codestart;
8098  *code = OP_BRA;  *code = OP_BRA;
8099  (void)compile_regex(re->options, &code, &ptr, &errorcode, FALSE, FALSE, 0, 0,  (void)compile_regex(re->options, &code, &ptr, &errorcode, FALSE, FALSE, 0, 0,
8100    &firstchar, &reqchar, NULL, cd, NULL);    &firstchar, &firstcharflags, &reqchar, &reqcharflags, NULL, cd, NULL);
8101  re->top_bracket = cd->bracount;  re->top_bracket = cd->bracount;
8102  re->top_backref = cd->top_backref;  re->top_backref = cd->top_backref;
8103  re->max_lookbehind = cd->max_lookbehind;  re->max_lookbehind = cd->max_lookbehind;
8104  re->flags = cd->external_flags | PCRE_MODE;  re->flags = cd->external_flags | PCRE_MODE;
8105    
8106  if (cd->had_accept) reqchar = REQ_NONE;   /* Must disable after (*ACCEPT) */  if (cd->had_accept)
8107      {
8108      reqchar = 0;              /* Must disable after (*ACCEPT) */
8109      reqcharflags = REQ_NONE;
8110      }
8111    
8112  /* 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. */
8113    
# Line 8060  if (errorcode == 0 && re->top_backref > Line 8157  if (errorcode == 0 && re->top_backref >
8157    
8158  /* If there were any lookbehind assertions that contained OP_RECURSE  /* If there were any lookbehind assertions that contained OP_RECURSE
8159  (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,
8160  because they may contain forward references. Actual recursions can't be fixed  because they may contain forward references. Actual recursions cannot be fixed
8161  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
8162  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
8163  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 8228  if ((re->options & PCRE_ANCHORED) == 0)
8228    if (is_anchored(codestart, 0, cd, 0)) re->options |= PCRE_ANCHORED;    if (is_anchored(codestart, 0, cd, 0)) re->options |= PCRE_ANCHORED;
8229    else    else
8230      {      {
8231      if (firstchar < 0)      if (firstcharflags < 0)
8232        firstchar = find_firstassertedchar(codestart, FALSE);        firstchar = find_firstassertedchar(codestart, &firstcharflags, FALSE);
8233      if (firstchar >= 0)   /* Remove caseless flag for non-caseable chars */      if (firstcharflags >= 0)   /* Remove caseless flag for non-caseable chars */
8234        {        {
8235  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
8236        re->first_char = firstchar & 0xff;        re->first_char = firstchar & 0xff;
8237  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
8238        re->first_char = firstchar & 0xffff;        re->first_char = firstchar & 0xffff;
8239  #elif defined COMPILE_PCRE32  #elif defined COMPILE_PCRE32
8240        re->first_char = firstchar & ~REQ_MASK;        re->first_char = firstchar;
8241  #endif  #endif
8242        if ((firstchar & REQ_CASELESS) != 0)        if ((firstcharflags & REQ_CASELESS) != 0)
8243          {          {
8244  #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)  #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)
8245          /* 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 8271  if ((re->options & PCRE_ANCHORED) == 0)
8271  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
8272  bytes. */  bytes. */
8273    
8274  if (reqchar >= 0 &&  if (reqcharflags >= 0 &&
8275       ((re->options & PCRE_ANCHORED) == 0 || (reqchar & REQ_VARY) != 0))       ((re->options & PCRE_ANCHORED) == 0 || (reqcharflags & REQ_VARY) != 0))
8276    {    {
8277  #if defined COMPILE_PCRE8  #if defined COMPILE_PCRE8
8278    re->req_char = reqchar & 0xff;    re->req_char = reqchar & 0xff;
8279  #elif defined COMPILE_PCRE16  #elif defined COMPILE_PCRE16
8280    re->req_char = reqchar & 0xffff;    re->req_char = reqchar & 0xffff;
8281  #elif defined COMPILE_PCRE32  #elif defined COMPILE_PCRE32
8282    re->req_char = reqchar & ~REQ_MASK;    re->req_char = reqchar;
8283  #endif  #endif
8284    if ((reqchar & REQ_CASELESS) != 0)    if ((reqcharflags & REQ_CASELESS) != 0)
8285      {      {
8286  #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)  #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)
8287      /* 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.1120

  ViewVC Help
Powered by ViewVC 1.1.5