/[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 392 by ph10, Tue Mar 17 21:30:30 2009 UTC
# Line 789  for (;;) Line 789  for (;;)
789      case OP_SCOND:      case OP_SCOND:
790      /* 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
791      inserted between OP_COND and an assertion condition. */      inserted between OP_COND and an assertion condition. */
792    
793      if (ecode[LINK_SIZE+1] == OP_CALLOUT)      if (ecode[LINK_SIZE+1] == OP_CALLOUT)
794        {        {
795        if (pcre_callout != NULL)        if (pcre_callout != NULL)
# Line 812  for (;;) Line 812  for (;;)
812          }          }
813        ecode += _pcre_OP_lengths[OP_CALLOUT];        ecode += _pcre_OP_lengths[OP_CALLOUT];
814        }        }
815    
816      /* Now see what the actual condition is */      /* Now see what the actual condition is */
817    
818      if (ecode[LINK_SIZE+1] == OP_RREF)         /* Recursion test */      if (ecode[LINK_SIZE+1] == OP_RREF)         /* Recursion test */
819        {        {
820        offset = GET2(ecode, LINK_SIZE + 2);     /* Recursion group number*/        offset = GET2(ecode, LINK_SIZE + 2);     /* Recursion group number*/
# Line 4716  for(;;) Line 4716  for(;;)
4716      register int *iend = iptr + resetcount;      register int *iend = iptr + resetcount;
4717      while (iptr < iend) *iptr++ = -1;      while (iptr < iend) *iptr++ = -1;
4718      }      }
4719    
4720    /* 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
4721    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
4722    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 4740  for(;;)
4740      while (t < md->end_subject && !IS_NEWLINE(t)) t++;      while (t < md->end_subject && !IS_NEWLINE(t)) t++;
4741      end_subject = t;      end_subject = t;
4742      }      }
4743    
4744    /* There are some optimizations that avoid running the match if a known    /* There are some optimizations that avoid running the match if a known
4745    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.
4746    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
4747    that all callouts do actually occur. */    that all callouts do actually occur. */
4748    
4749    if ((options & PCRE_NO_START_OPTIMIZE) == 0)    if ((options & PCRE_NO_START_OPTIMIZE) == 0)
4750      {      {
4751      /* Advance to a unique first byte if there is one. */      /* Advance to a unique first byte if there is one. */
4752    
4753      if (first_byte >= 0)      if (first_byte >= 0)
# Line 4759  for(;;) Line 4759  for(;;)
4759          while (start_match < end_subject && *start_match != first_byte)          while (start_match < end_subject && *start_match != first_byte)
4760            start_match++;            start_match++;
4761        }        }
4762    
4763      /* Or to just after a linebreak for a multiline match */      /* Or to just after a linebreak for a multiline match */
4764    
4765      else if (startline)      else if (startline)
4766        {        {
4767        if (start_match > md->start_subject + start_offset)        if (start_match > md->start_subject + start_offset)
# Line 4780  for(;;) Line 4780  for(;;)
4780  #endif  #endif
4781          while (start_match < end_subject && !WAS_NEWLINE(start_match))          while (start_match < end_subject && !WAS_NEWLINE(start_match))
4782            start_match++;            start_match++;
4783    
4784          /* 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,
4785          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.
4786          */          */
4787    
4788          if (start_match[-1] == CHAR_CR &&          if (start_match[-1] == CHAR_CR &&
4789               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&               (md->nltype == NLTYPE_ANY || md->nltype == NLTYPE_ANYCRLF) &&
4790               start_match < end_subject &&               start_match < end_subject &&
# Line 4792  for(;;) Line 4792  for(;;)
4792            start_match++;            start_match++;
4793          }          }
4794        }        }
4795    
4796      /* Or to a non-unique first byte after study */      /* Or to a non-unique first byte after study */
4797    
4798      else if (start_bits != NULL)      else if (start_bits != NULL)
4799        {        {
4800        while (start_match < end_subject)        while (start_match < end_subject)
# Line 4805  for(;;) Line 4805  for(;;)
4805          }          }
4806        }        }
4807      }   /* Starting optimizations */      }   /* Starting optimizations */
4808    
4809    /* Restore fudged end_subject */    /* Restore fudged end_subject */
4810    
4811    end_subject = save_end_subject;    end_subject = save_end_subject;
4812    
4813  #ifdef DEBUG  /* Sigh. Some compilers never learn. */  #ifdef DEBUG  /* Sigh. Some compilers never learn. */
# Line 4830  for(;;) Line 4830  for(;;)
4830    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
4831    long.    long.
4832    
4833    ALSO: this processing is disabled when partial matching is requested, or if    ALSO: this processing is disabled when partial matching is requested, or if
4834    disabling is explicitly requested. */    disabling is explicitly requested. */
4835    
4836    if ((options & PCRE_NO_START_OPTIMIZE) == 0 &&    if ((options & PCRE_NO_START_OPTIMIZE) == 0 &&

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

  ViewVC Help
Powered by ViewVC 1.1.5