/[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 615 by ph10, Mon Jul 11 14:23:06 2011 UTC revision 617 by ph10, Tue Jul 12 11:00:10 2011 UTC
# Line 808  for (;;) Line 808  for (;;)
808      subject position in the working slot at the top of the vector. We mustn't      subject position in the working slot at the top of the vector. We mustn't
809      change the current values of the data slot, because they may be set from a      change the current values of the data slot, because they may be set from a
810      previous iteration of this group, and be referred to by a reference inside      previous iteration of this group, and be referred to by a reference inside
811      the group. If we fail to match, we need to restore this value and also the      the group. A failure to match might occur after the group has succeeded,
812      values of the final offsets, in case they were set by a previous iteration      if something later on doesn't match. For this reason, we need to restore
813      of the same bracket.      the working value and also the values of the final offsets, in case they
814        were set by a previous iteration of the same bracket.
815    
816      If there isn't enough space in the offset vector, treat this as if it were      If there isn't enough space in the offset vector, treat this as if it were
817      a non-capturing bracket. Don't worry about setting the flag for the error      a non-capturing bracket. Don't worry about setting the flag for the error
# Line 1488  for (;;) Line 1489  for (;;)
1489      65535 such values, which is too large to put on the stack, but using malloc      65535 such values, which is too large to put on the stack, but using malloc
1490      for small numbers seems expensive. As a compromise, the stack is used when      for small numbers seems expensive. As a compromise, the stack is used when
1491      there are no more than REC_STACK_SAVE_MAX values to store; otherwise malloc      there are no more than REC_STACK_SAVE_MAX values to store; otherwise malloc
1492      is used. A problem is what to do if the malloc fails ... there is no way of      is used.
     returning to the top level with an error. Save the top REC_STACK_SAVE_MAX  
     values on the stack, and accept that the rest may be wrong.  
1493    
1494      There are also other values that have to be saved. We use a chained      There are also other values that have to be saved. We use a chained
1495      sequence of blocks that actually live on the stack. Thanks to Robin Houston      sequence of blocks that actually live on the stack. Thanks to Robin Houston
# Line 1612  for (;;) Line 1611  for (;;)
1611      /* For a non-repeating ket, just continue at this level. This also      /* For a non-repeating ket, just continue at this level. This also
1612      happens for a repeating ket if no characters were matched in the group.      happens for a repeating ket if no characters were matched in the group.
1613      This is the forcible breaking of infinite loops as implemented in Perl      This is the forcible breaking of infinite loops as implemented in Perl
1614      5.005. If there is an options reset, it will get obeyed in the normal      5.005. */
     course of events. */  
1615    
1616      if (*ecode == OP_KET || eptr == saved_eptr)      if (*ecode == OP_KET || eptr == saved_eptr)
1617        {        {
# Line 1630  for (;;) Line 1628  for (;;)
1628        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM8);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM8);
1629        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1630        ecode = prev;        ecode = prev;
       goto TAIL_RECURSE;  
1631        }        }
1632      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
1633        {        {
# Line 1638  for (;;) Line 1635  for (;;)
1635        RMATCH(eptr, prev, offset_top, md, eptrb, RM9);        RMATCH(eptr, prev, offset_top, md, eptrb, RM9);
1636        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1637        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
       goto TAIL_RECURSE;  
1638        }        }
1639        goto TAIL_RECURSE;
1640    
1641      /* Control never gets here */      /* Control never gets here */
1642    
1643      /* An alternation is the end of a branch; scan along to find the end of the      /* An alternation is the end of a branch; scan along to find the end of the

Legend:
Removed from v.615  
changed lines
  Added in v.617

  ViewVC Help
Powered by ViewVC 1.1.5