/[pcre]/code/trunk/pcre_exec.c
ViewVC logotype

Diff of /code/trunk/pcre_exec.c

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

revision 391 by ph10, Tue Mar 17 21:16:01 2009 UTC revision 402 by ph10, Sat Mar 21 17:26:03 2009 UTC
# Line 334  typedef struct heapframe { Line 334  typedef struct heapframe {
334    /* Function local variables */    /* Function local variables */
335    
336    const uschar *Xcallpat;    const uschar *Xcallpat;
337    #ifdef SUPPORT_UTF8
338    const uschar *Xcharptr;    const uschar *Xcharptr;
339    #endif
340    const uschar *Xdata;    const uschar *Xdata;
341    const uschar *Xnext;    const uschar *Xnext;
342    const uschar *Xpp;    const uschar *Xpp;
# Line 561  int oclength; Line 563  int oclength;
563  uschar occhars[8];  uschar occhars[8];
564  #endif  #endif
565    
566    int codelink;
567    int condcode;
568  int ctype;  int ctype;
569  int length;  int length;
570  int max;  int max;
# Line 635  for (;;) Line 639  for (;;)
639    {    {
640    minimize = possessive = FALSE;    minimize = possessive = FALSE;
641    op = *ecode;    op = *ecode;
642    
643    /* For partial matching, remember if we ever hit the end of the subject after    /* For partial matching, remember if we ever hit the end of the subject after
644    matching at least one subject character. */    matching at least one subject character. */
645    
# Line 787  for (;;) Line 791  for (;;)
791    
792      case OP_COND:      case OP_COND:
793      case OP_SCOND:      case OP_SCOND:
794        codelink= GET(ecode, 1);
795    
796      /* Because of the way auto-callout works during compile, a callout item is      /* Because of the way auto-callout works during compile, a callout item is
797      inserted between OP_COND and an assertion condition. */      inserted between OP_COND and an assertion condition. */
798    
799      if (ecode[LINK_SIZE+1] == OP_CALLOUT)      if (ecode[LINK_SIZE+1] == OP_CALLOUT)
800        {        {
801        if (pcre_callout != NULL)        if (pcre_callout != NULL)
# Line 812  for (;;) Line 818  for (;;)
818          }          }
819        ecode += _pcre_OP_lengths[OP_CALLOUT];        ecode += _pcre_OP_lengths[OP_CALLOUT];
820        }        }
821    
822        condcode = ecode[LINK_SIZE+1];
823    
824      /* Now see what the actual condition is */      /* Now see what the actual condition is */
825    
826      if (ecode[LINK_SIZE+1] == OP_RREF)         /* Recursion test */      if (condcode == OP_RREF)         /* Recursion test */
827        {        {
828        offset = GET2(ecode, LINK_SIZE + 2);     /* Recursion group number*/        offset = GET2(ecode, LINK_SIZE + 2);     /* Recursion group number*/
829        condition = md->recursive != NULL &&        condition = md->recursive != NULL &&
# Line 823  for (;;) Line 831  for (;;)
831        ecode += condition? 3 : GET(ecode, 1);        ecode += condition? 3 : GET(ecode, 1);
832        }        }
833    
834      else if (ecode[LINK_SIZE+1] == OP_CREF)    /* Group used test */      else if (condcode == OP_CREF)    /* Group used test */
835        {        {
836        offset = GET2(ecode, LINK_SIZE+2) << 1;  /* Doubled ref number */        offset = GET2(ecode, LINK_SIZE+2) << 1;  /* Doubled ref number */
837        condition = offset < offset_top && md->offset_vector[offset] >= 0;        condition = offset < offset_top && md->offset_vector[offset] >= 0;
838        ecode += condition? 3 : GET(ecode, 1);        ecode += condition? 3 : GET(ecode, 1);
839        }        }
840    
841      else if (ecode[LINK_SIZE+1] == OP_DEF)     /* DEFINE - always false */      else if (condcode == OP_DEF)     /* DEFINE - always false */
842        {        {
843        condition = FALSE;        condition = FALSE;
844        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
# Line 857  for (;;) Line 865  for (;;)
865        else        else
866          {          {
867          condition = FALSE;          condition = FALSE;
868          ecode += GET(ecode, 1);          ecode += codelink;
869          }          }
870        }        }
871    
# Line 880  for (;;) Line 888  for (;;)
888          goto TAIL_RECURSE;          goto TAIL_RECURSE;
889          }          }
890        }        }
891      else                         /* Condition false & no 2nd alternative */      else                         /* Condition false & no alternative */
892        {        {
893        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
894        }        }
# Line 1103  for (;;) Line 1111  for (;;)
1111          else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)          else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
1112            {            {
1113            DPRINTF(("Recursion gave error %d\n", rrc));            DPRINTF(("Recursion gave error %d\n", rrc));
1114              if (new_recursive.offset_save != stacksave)
1115                (pcre_free)(new_recursive.offset_save);
1116            RRETURN(rrc);            RRETURN(rrc);
1117            }            }
1118    
# Line 4716  for(;;) Line 4726  for(;;)
4726      register int *iend = iptr + resetcount;      register int *iend = iptr + resetcount;
4727      while (iptr < iend) *iptr++ = -1;      while (iptr < iend) *iptr++ = -1;
4728      }      }
4729    
4730    /* If firstline is TRUE, the start of the match is constrained to the first    /* If firstline is TRUE, the start of the match is constrained to the first
4731    line of a multiline string. That is, the match must be before or at the first    line of a multiline string. That is, the match must be before or at the first
4732    newline. Implement this by temporarily adjusting end_subject so that we stop    newline. Implement this by temporarily adjusting end_subject so that we stop
# Line 4740  for(;;) Line 4750  for(;;)
4750      while (t < md->end_subject && !IS_NEWLINE(t)) t++;      while (t < md->end_subject && !IS_NEWLINE(t)) t++;
4751      end_subject = t;      end_subject = t;
4752      }      }
4753    
4754    /* There are some optimizations that avoid running the match if a known    /* There are some optimizations that avoid running the match if a known
4755    starting point is not found, or if a known later character is not present.    starting point is not found, or if a known later character is not present.
4756    However, there is an option that disables these, for testing and for ensuring    However, there is an option that disables these, for testing and for ensuring
4757    that all callouts do actually occur. */    that all callouts do actually occur. */
4758    
4759    if ((options & PCRE_NO_START_OPTIMIZE) == 0)    if ((options & PCRE_NO_START_OPTIMIZE) == 0)
4760      {      {
4761      /* Advance to a unique first byte if there is one. */      /* Advance to a unique first byte if there is one. */
4762    
4763      if (first_byte >= 0)      if (first_byte >= 0)
# Line 4759  for(;;) Line 4769  for(;;)
4769          while (start_match < end_subject && *start_match != first_byte)          while (start_match < end_subject && *start_match != first_byte)
4770            start_match++;            start_match++;
4771        }        }
4772    
4773      /* Or to just after a linebreak for a multiline match */      /* Or to just after a linebreak for a multiline match */
4774    
4775      else if (startline)      else if (startline)
4776        {        {
4777        if (start_match > md->start_subject + start_offset)        if (start_match > md->start_subject + start_offset)
# Line 4780  for(;;) Line 4790  for(;;)
4790  #endif  #endif
4791          while (start_match < end_subject && !WAS_NEWLINE(start_match))          while (start_match < end_subject && !WAS_NEWLINE(start_match))
4792            start_match++;            start_match++;
4793    
4794          /* If we have just passed a CR and the newline option is ANY or ANYCRLF,          /* If we have just passed a CR and the newline option is ANY or ANYCRLF,
4795          and we are now at a LF, advance the match position by one more character.          and we are now at a LF, advance the match position by one more character.
4796          */          */
4797    
4798          if (start_match[-1] == CHAR_CR &&          if (start_match[-1] == CHAR_CR &&
4799               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&
4800               start_match < end_subject &&               start_match < end_subject &&
# Line 4792  for(;;) Line 4802  for(;;)
4802            start_match++;            start_match++;
4803          }          }
4804        }        }
4805    
4806      /* Or to a non-unique first byte after study */      /* Or to a non-unique first byte after study */
4807    
4808      else if (start_bits != NULL)      else if (start_bits != NULL)
4809        {        {
4810        while (start_match < end_subject)        while (start_match < end_subject)
# Line 4805  for(;;) Line 4815  for(;;)
4815          }          }
4816        }        }
4817      }   /* Starting optimizations */      }   /* Starting optimizations */
4818    
4819    /* Restore fudged end_subject */    /* Restore fudged end_subject */
4820    
4821    end_subject = save_end_subject;    end_subject = save_end_subject;
4822    
4823  #ifdef DEBUG  /* Sigh. Some compilers never learn. */  #ifdef DEBUG  /* Sigh. Some compilers never learn. */
# Line 4830  for(;;) Line 4840  for(;;)
4840    32-megabyte string... so we don't do this when the string is sufficiently    32-megabyte string... so we don't do this when the string is sufficiently
4841    long.    long.
4842    
4843    ALSO: this processing is disabled when partial matching is requested, or if    ALSO: this processing is disabled when partial matching is requested, or if
4844    disabling is explicitly requested. */    disabling is explicitly requested. */
4845    
4846    if ((options & PCRE_NO_START_OPTIMIZE) == 0 &&    if ((options & PCRE_NO_START_OPTIMIZE) == 0 &&

Legend:
Removed from v.391  
changed lines
  Added in v.402

  ViewVC Help
Powered by ViewVC 1.1.5