/[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 613 by ph10, Sat Jul 2 16:59:52 2011 UTC revision 614 by ph10, Sat Jul 9 10:48:16 2011 UTC
# Line 847  for (;;) Line 847  for (;;)
847          if (rrc != MATCH_NOMATCH &&          if (rrc != MATCH_NOMATCH &&
848              (rrc != MATCH_THEN || md->start_match_ptr != ecode))              (rrc != MATCH_THEN || md->start_match_ptr != ecode))
849            RRETURN(rrc);            RRETURN(rrc);
850    
851            /* If md->end_offset_top is greater than offset_top, it means that the
852            branch we have just failed to match did manage to match some capturing
853            parentheses within an atomic group or an assertion. Although offset_top
854            reverts to its original value at this level, we must unset the captured
855            values in case a later match sets a higher capturing number. Example:
856            matching /((?>(a))b|(a)c)/ against "ac". This captures 3, but we need
857            to ensure that 2 - which was captured in the atomic matching - is
858            unset. */
859    
860            if (md->end_offset_top > offset_top)
861              {
862              register int *iptr = md->offset_vector + offset_top;
863              register int *iend = md->offset_vector + md->end_offset_top;
864              while (iptr < iend) *iptr++ = -1;
865              }
866    
867          md->capture_last = save_capture_last;          md->capture_last = save_capture_last;
868          ecode += GET(ecode, 1);          ecode += GET(ecode, 1);
869          if (*ecode != OP_ALT) break;          if (*ecode != OP_ALT) break;
# Line 892  for (;;) Line 909  for (;;)
909        if (rrc != MATCH_NOMATCH &&        if (rrc != MATCH_NOMATCH &&
910            (rrc != MATCH_THEN || md->start_match_ptr != ecode))            (rrc != MATCH_THEN || md->start_match_ptr != ecode))
911          RRETURN(rrc);          RRETURN(rrc);
912    
913          /* See explanatory comment above under OP_CBRA. */
914    
915          if (md->end_offset_top > offset_top)
916            {
917            register int *iptr = md->offset_vector + offset_top;
918            register int *iend = md->offset_vector + md->end_offset_top;
919            while (iptr < iend) *iptr++ = -1;
920            }
921    
922        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
923        if (*ecode != OP_ALT) break;        if (*ecode != OP_ALT) break;
924        }        }
# Line 962  for (;;) Line 989  for (;;)
989          if (rrc != MATCH_NOMATCH &&          if (rrc != MATCH_NOMATCH &&
990              (rrc != MATCH_THEN || md->start_match_ptr != ecode))              (rrc != MATCH_THEN || md->start_match_ptr != ecode))
991            RRETURN(rrc);            RRETURN(rrc);
992    
993            /* See explanatory comment above under OP_CBRA. */
994    
995            if (md->end_offset_top > offset_top)
996              {
997              register int *iptr = md->offset_vector + offset_top;
998              register int *iend = md->offset_vector + md->end_offset_top;
999              while (iptr < iend) *iptr++ = -1;
1000              }
1001    
1002          md->capture_last = save_capture_last;          md->capture_last = save_capture_last;
1003          ecode += GET(ecode, 1);          ecode += GET(ecode, 1);
1004          if (*ecode != OP_ALT) break;          if (*ecode != OP_ALT) break;
# Line 1024  for (;;) Line 1061  for (;;)
1061        if (rrc != MATCH_NOMATCH &&        if (rrc != MATCH_NOMATCH &&
1062            (rrc != MATCH_THEN || md->start_match_ptr != ecode))            (rrc != MATCH_THEN || md->start_match_ptr != ecode))
1063          RRETURN(rrc);          RRETURN(rrc);
1064    
1065          /* See explanatory comment above under OP_CBRA. */
1066    
1067          if (md->end_offset_top > offset_top)
1068            {
1069            register int *iptr = md->offset_vector + offset_top;
1070            register int *iend = md->offset_vector + md->end_offset_top;
1071            while (iptr < iend) *iptr++ = -1;
1072            }
1073    
1074        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
1075        if (*ecode != OP_ALT) break;        if (*ecode != OP_ALT) break;
1076        }        }
# Line 1366  for (;;) Line 1413  for (;;)
1413        if (rrc != MATCH_NOMATCH &&        if (rrc != MATCH_NOMATCH &&
1414            (rrc != MATCH_THEN || md->start_match_ptr != ecode))            (rrc != MATCH_THEN || md->start_match_ptr != ecode))
1415          RRETURN(rrc);          RRETURN(rrc);
1416    
1417          /* See explanatory comment above under OP_CBRA. */
1418    
1419          if (md->end_offset_top > offset_top)
1420            {
1421            register int *iptr = md->offset_vector + offset_top;
1422            register int *iend = md->offset_vector + md->end_offset_top;
1423            while (iptr < iend) *iptr++ = -1;
1424            }
1425    
1426        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
1427        }        }
1428      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
# Line 1593  for (;;) Line 1650  for (;;)
1650        if (rrc != MATCH_NOMATCH &&        if (rrc != MATCH_NOMATCH &&
1651            (rrc != MATCH_THEN || md->start_match_ptr != ecode))            (rrc != MATCH_THEN || md->start_match_ptr != ecode))
1652          RRETURN(rrc);          RRETURN(rrc);
1653    
1654          /* See explanatory comment above under OP_CBRA. */
1655    
1656          if (md->end_offset_top > offset_top)
1657            {
1658            register int *iptr = md->offset_vector + offset_top;
1659            register int *iend = md->offset_vector + md->end_offset_top;
1660            while (iptr < iend) *iptr++ = -1;
1661            }
1662    
1663        ecode += GET(ecode,1);        ecode += GET(ecode,1);
1664        }        }
1665      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
# Line 1601  for (;;) Line 1668  for (;;)
1668    
1669      if (*ecode != OP_ONCE && *ecode != OP_ALT) RRETURN(MATCH_NOMATCH);      if (*ecode != OP_ONCE && *ecode != OP_ALT) RRETURN(MATCH_NOMATCH);
1670    
1671      /* Continue as from after the assertion, updating the offsets high water      /* Continue after the group, updating the offsets high water mark, since
1672      mark, since extracts may have been taken. */      extracts may have been taken. */
1673    
1674      do ecode += GET(ecode, 1); while (*ecode == OP_ALT);      do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
1675    
# Line 6298  for(;;) Line 6365  for(;;)
6365    md->start_used_ptr = start_match;    md->start_used_ptr = start_match;
6366    md->match_call_count = 0;    md->match_call_count = 0;
6367    md->match_function_type = 0;    md->match_function_type = 0;
6368      md->end_offset_top = 0;
6369    rc = match(start_match, md->start_code, start_match, NULL, 2, md, NULL, 0);    rc = match(start_match, md->start_code, start_match, NULL, 2, md, NULL, 0);
6370    if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr;    if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr;
6371    

Legend:
Removed from v.613  
changed lines
  Added in v.614

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12