/[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 427 by ph10, Fri Aug 28 09:55:54 2009 UTC revision 435 by ph10, Sat Sep 5 10:20:44 2009 UTC
# Line 408  immediately. The second one is used when Line 408  immediately. The second one is used when
408  the subject. */  the subject. */
409    
410  #define CHECK_PARTIAL()\  #define CHECK_PARTIAL()\
411    if (md->partial && eptr >= md->end_subject && eptr > mstart)\    if (md->partial != 0 && eptr >= md->end_subject && eptr > mstart)\
412      {\      {\
413      md->hitend = TRUE;\      md->hitend = TRUE;\
414      if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\      if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\
# Line 418  the subject. */ Line 418  the subject. */
418    if (md->partial && eptr > mstart)\    if (md->partial && eptr > mstart)\
419      {\      {\
420      md->hitend = TRUE;\      md->hitend = TRUE;\
     md->hitend = TRUE;\  
421      if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\      if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL);\
422      }      }
423    
# Line 664  for (;;) Line 663  for (;;)
663    {    {
664    minimize = possessive = FALSE;    minimize = possessive = FALSE;
665    op = *ecode;    op = *ecode;
666    
   /* For partial matching, remember if we ever hit the end of the subject after  
   matching at least one subject character. This code is now wrapped in a macro  
   because it appears several times below. */  
   
   CHECK_PARTIAL();  
   
667    switch(op)    switch(op)
668      {      {
669      case OP_FAIL:      case OP_FAIL:
# Line 1031  for (;;) Line 1024  for (;;)
1024        if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);        if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
1025        }        }
1026    
1027      /* Skip to next op code */      /* Save the earliest consulted character, then skip to next op code */
1028    
1029        if (eptr < md->start_used_ptr) md->start_used_ptr = eptr;
1030      ecode += 1 + LINK_SIZE;      ecode += 1 + LINK_SIZE;
1031      break;      break;
1032    
# Line 1475  for (;;) Line 1469  for (;;)
1469    
1470        /* Find out if the previous and current characters are "word" characters.        /* Find out if the previous and current characters are "word" characters.
1471        It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to        It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to
1472        be "non-word" characters. */        be "non-word" characters. Remember the earliest consulted character for
1473          partial matching. */
1474    
1475  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1476        if (utf8)        if (utf8)
# Line 1484  for (;;) Line 1479  for (;;)
1479            {            {
1480            USPTR lastptr = eptr - 1;            USPTR lastptr = eptr - 1;
1481            while((*lastptr & 0xc0) == 0x80) lastptr--;            while((*lastptr & 0xc0) == 0x80) lastptr--;
1482              if (lastptr < md->start_used_ptr) md->start_used_ptr = lastptr;
1483            GETCHAR(c, lastptr);            GETCHAR(c, lastptr);
1484            prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;            prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
1485            }            }
1486          if (eptr >= md->end_subject) cur_is_word = FALSE; else          if (eptr >= md->end_subject)
1487              {
1488              SCHECK_PARTIAL();
1489              cur_is_word = FALSE;
1490              }
1491            else
1492            {            {
1493            GETCHAR(c, eptr);            GETCHAR(c, eptr);
1494            cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;            cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
# Line 1496  for (;;) Line 1497  for (;;)
1497        else        else
1498  #endif  #endif
1499    
1500        /* More streamlined when not in UTF-8 mode */        /* Not in UTF-8 mode */
1501    
1502          {          {
1503          prev_is_word = (eptr != md->start_subject) &&          if (eptr == md->start_subject) prev_is_word = FALSE; else
1504            ((md->ctypes[eptr[-1]] & ctype_word) != 0);            {
1505          cur_is_word = (eptr < md->end_subject) &&            if (eptr <= md->start_used_ptr) md->start_used_ptr = eptr - 1;
1506            ((md->ctypes[*eptr] & ctype_word) != 0);            prev_is_word = ((md->ctypes[eptr[-1]] & ctype_word) != 0);
1507              }
1508            if (eptr >= md->end_subject)
1509              {
1510              SCHECK_PARTIAL();
1511              cur_is_word = FALSE;
1512              }
1513            else cur_is_word = ((md->ctypes[*eptr] & ctype_word) != 0);
1514          }          }
1515    
1516        /* Now see if the situation is what we want */        /* Now see if the situation is what we want */
# Line 1520  for (;;) Line 1528  for (;;)
1528      /* Fall through */      /* Fall through */
1529    
1530      case OP_ALLANY:      case OP_ALLANY:
1531      if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr++ >= md->end_subject)
1532          {
1533          SCHECK_PARTIAL();
1534          RRETURN(MATCH_NOMATCH);
1535          }
1536      if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;      if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
1537      ecode++;      ecode++;
1538      break;      break;
# Line 1529  for (;;) Line 1541  for (;;)
1541      any byte, even newline, independent of the setting of PCRE_DOTALL. */      any byte, even newline, independent of the setting of PCRE_DOTALL. */
1542    
1543      case OP_ANYBYTE:      case OP_ANYBYTE:
1544      if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr++ >= md->end_subject)
1545          {
1546          SCHECK_PARTIAL();
1547          RRETURN(MATCH_NOMATCH);
1548          }
1549      ecode++;      ecode++;
1550      break;      break;
1551    
1552      case OP_NOT_DIGIT:      case OP_NOT_DIGIT:
1553      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1554          {
1555          SCHECK_PARTIAL();
1556          RRETURN(MATCH_NOMATCH);
1557          }
1558      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1559      if (      if (
1560  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 1547  for (;;) Line 1567  for (;;)
1567      break;      break;
1568    
1569      case OP_DIGIT:      case OP_DIGIT:
1570      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1571          {
1572          SCHECK_PARTIAL();
1573          RRETURN(MATCH_NOMATCH);
1574          }
1575      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1576      if (      if (
1577  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 1560  for (;;) Line 1584  for (;;)
1584      break;      break;
1585    
1586      case OP_NOT_WHITESPACE:      case OP_NOT_WHITESPACE:
1587      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1588          {
1589          SCHECK_PARTIAL();
1590          RRETURN(MATCH_NOMATCH);
1591          }
1592      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1593      if (      if (
1594  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 1573  for (;;) Line 1601  for (;;)
1601      break;      break;
1602    
1603      case OP_WHITESPACE:      case OP_WHITESPACE:
1604      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1605          {
1606          SCHECK_PARTIAL();
1607          RRETURN(MATCH_NOMATCH);
1608          }
1609      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1610      if (      if (
1611  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 1586  for (;;) Line 1618  for (;;)
1618      break;      break;
1619    
1620      case OP_NOT_WORDCHAR:      case OP_NOT_WORDCHAR:
1621      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1622          {
1623          SCHECK_PARTIAL();
1624          RRETURN(MATCH_NOMATCH);
1625          }
1626      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1627      if (      if (
1628  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 1599  for (;;) Line 1635  for (;;)
1635      break;      break;
1636    
1637      case OP_WORDCHAR:      case OP_WORDCHAR:
1638      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1639          {
1640          SCHECK_PARTIAL();
1641          RRETURN(MATCH_NOMATCH);
1642          }
1643      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1644      if (      if (
1645  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
# Line 1612  for (;;) Line 1652  for (;;)
1652      break;      break;
1653    
1654      case OP_ANYNL:      case OP_ANYNL:
1655      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1656          {
1657          SCHECK_PARTIAL();
1658          RRETURN(MATCH_NOMATCH);
1659          }
1660      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1661      switch(c)      switch(c)
1662        {        {
# Line 1636  for (;;) Line 1680  for (;;)
1680      break;      break;
1681    
1682      case OP_NOT_HSPACE:      case OP_NOT_HSPACE:
1683      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1684          {
1685          SCHECK_PARTIAL();
1686          RRETURN(MATCH_NOMATCH);
1687          }
1688      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1689      switch(c)      switch(c)
1690        {        {
# Line 1666  for (;;) Line 1714  for (;;)
1714      break;      break;
1715    
1716      case OP_HSPACE:      case OP_HSPACE:
1717      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1718          {
1719          SCHECK_PARTIAL();
1720          RRETURN(MATCH_NOMATCH);
1721          }
1722      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1723      switch(c)      switch(c)
1724        {        {
# Line 1696  for (;;) Line 1748  for (;;)
1748      break;      break;
1749    
1750      case OP_NOT_VSPACE:      case OP_NOT_VSPACE:
1751      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1752          {
1753          SCHECK_PARTIAL();
1754          RRETURN(MATCH_NOMATCH);
1755          }
1756      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1757      switch(c)      switch(c)
1758        {        {
# Line 1714  for (;;) Line 1770  for (;;)
1770      break;      break;
1771    
1772      case OP_VSPACE:      case OP_VSPACE:
1773      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1774          {
1775          SCHECK_PARTIAL();
1776          RRETURN(MATCH_NOMATCH);
1777          }
1778      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1779      switch(c)      switch(c)
1780        {        {
# Line 1737  for (;;) Line 1797  for (;;)
1797    
1798      case OP_PROP:      case OP_PROP:
1799      case OP_NOTPROP:      case OP_NOTPROP:
1800      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1801          {
1802          SCHECK_PARTIAL();
1803          RRETURN(MATCH_NOMATCH);
1804          }
1805      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1806        {        {
1807        const ucd_record *prop = GET_UCD(c);        const ucd_record *prop = GET_UCD(c);
# Line 1782  for (;;) Line 1846  for (;;)
1846      is in the binary; otherwise a compile-time error occurs. */      is in the binary; otherwise a compile-time error occurs. */
1847    
1848      case OP_EXTUNI:      case OP_EXTUNI:
1849      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
1850          {
1851          SCHECK_PARTIAL();
1852          RRETURN(MATCH_NOMATCH);
1853          }
1854      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
1855        {        {
1856        int category = UCD_CATEGORY(c);        int category = UCD_CATEGORY(c);
# Line 1862  for (;;) Line 1930  for (;;)
1930          break;          break;
1931    
1932          default:               /* No repeat follows */          default:               /* No repeat follows */
1933          if (!match_ref(offset, eptr, length, md, ims)) RRETURN(MATCH_NOMATCH);          if (!match_ref(offset, eptr, length, md, ims))
1934              {
1935              CHECK_PARTIAL();
1936              RRETURN(MATCH_NOMATCH);
1937              }
1938          eptr += length;          eptr += length;
1939          continue;              /* With the main loop */          continue;              /* With the main loop */
1940          }          }
1941    
1942        /* If the length of the reference is zero, just continue with the        /* If the length of the reference is zero, just continue with the
1943        main loop. */        main loop. */
1944    
1945        if (length == 0) continue;        if (length == 0) continue;
1946    
1947        /* First, ensure the minimum number of matches are present. We get back        /* First, ensure the minimum number of matches are present. We get back
# Line 1899  for (;;) Line 1971  for (;;)
1971            {            {
1972            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14);
1973            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1974            if (fi >= max || !match_ref(offset, eptr, length, md, ims))            if (fi >= max) RRETURN(MATCH_NOMATCH);
1975              if (!match_ref(offset, eptr, length, md, ims))
1976              {              {
1977              CHECK_PARTIAL();              CHECK_PARTIAL();
1978              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
# Line 1919  for (;;) Line 1992  for (;;)
1992            if (!match_ref(offset, eptr, length, md, ims)) break;            if (!match_ref(offset, eptr, length, md, ims)) break;
1993            eptr += length;            eptr += length;
1994            }            }
         CHECK_PARTIAL();  
1995          while (eptr >= pp)          while (eptr >= pp)
1996            {            {
1997            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15);
# Line 1931  for (;;) Line 2003  for (;;)
2003        }        }
2004      /* Control never gets here */      /* Control never gets here */
2005    
   
   
2006      /* Match a bit-mapped character class, possibly repeatedly. This op code is      /* Match a bit-mapped character class, possibly repeatedly. This op code is
2007      used when all the characters in the class have values in the range 0-255,      used when all the characters in the class have values in the range 0-255,
2008      and either the matching is caseful, or the characters are in the range      and either the matching is caseful, or the characters are in the range
# Line 1989  for (;;) Line 2059  for (;;)
2059            {            {
2060            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
2061              {              {
2062              CHECK_PARTIAL();              SCHECK_PARTIAL();
2063              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
2064              }              }
2065            GETCHARINC(c, eptr);            GETCHARINC(c, eptr);
# Line 2011  for (;;) Line 2081  for (;;)
2081            {            {
2082            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
2083              {              {
2084              CHECK_PARTIAL();              SCHECK_PARTIAL();
2085              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
2086              }              }
2087            c = *eptr++;            c = *eptr++;
# Line 2037  for (;;) Line 2107  for (;;)
2107              {              {
2108              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16);
2109              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2110              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
2111              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
2112                {                {
2113                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 2066  for (;;) Line 2132  for (;;)
2132              {              {
2133              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17);
2134              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2135              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
2136              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
2137                {                {
2138                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 2108  for (;;) Line 2170  for (;;)
2170                }                }
2171              eptr += len;              eptr += len;
2172              }              }
           CHECK_PARTIAL();  
2173            for (;;)            for (;;)
2174              {              {
2175              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM18);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM18);
# Line 2128  for (;;) Line 2189  for (;;)
2189              if ((data[c/8] & (1 << (c&7))) == 0) break;              if ((data[c/8] & (1 << (c&7))) == 0) break;
2190              eptr++;              eptr++;
2191              }              }
           CHECK_PARTIAL();  
2192            while (eptr >= pp)            while (eptr >= pp)
2193              {              {
2194              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM19);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM19);
# Line 2209  for (;;) Line 2269  for (;;)
2269            {            {
2270            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20);
2271            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2272            if (fi >= max)            if (fi >= max) RRETURN(MATCH_NOMATCH);
             {  
             CHECK_PARTIAL();  
             RRETURN(MATCH_NOMATCH);  
             }  
2273            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
2274              {              {
2275              SCHECK_PARTIAL();              SCHECK_PARTIAL();
# Line 2238  for (;;) Line 2294  for (;;)
2294            if (!_pcre_xclass(c, data)) break;            if (!_pcre_xclass(c, data)) break;
2295            eptr += len;            eptr += len;
2296            }            }
         CHECK_PARTIAL();  
2297          for(;;)          for(;;)
2298            {            {
2299            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM21);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM21);
# Line 2262  for (;;) Line 2317  for (;;)
2317        length = 1;        length = 1;
2318        ecode++;        ecode++;
2319        GETCHARLEN(fc, ecode, length);        GETCHARLEN(fc, ecode, length);
2320        if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);        if (length > md->end_subject - eptr)
2321            {
2322            CHECK_PARTIAL();             /* Not SCHECK_PARTIAL() */
2323            RRETURN(MATCH_NOMATCH);
2324            }
2325        while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH);        while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH);
2326        }        }
2327      else      else
# Line 2270  for (;;) Line 2329  for (;;)
2329    
2330      /* Non-UTF-8 mode */      /* Non-UTF-8 mode */
2331        {        {
2332        if (md->end_subject - eptr < 1) RRETURN(MATCH_NOMATCH);        if (md->end_subject - eptr < 1)
2333            {
2334            SCHECK_PARTIAL();            /* This one can use SCHECK_PARTIAL() */
2335            RRETURN(MATCH_NOMATCH);
2336            }
2337        if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH);        if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH);
2338        ecode += 2;        ecode += 2;
2339        }        }
# Line 2286  for (;;) Line 2349  for (;;)
2349        ecode++;        ecode++;
2350        GETCHARLEN(fc, ecode, length);        GETCHARLEN(fc, ecode, length);
2351    
2352        if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);        if (length > md->end_subject - eptr)
2353            {
2354            CHECK_PARTIAL();             /* Not SCHECK_PARTIAL() */
2355            RRETURN(MATCH_NOMATCH);
2356            }
2357    
2358        /* If the pattern character's value is < 128, we have only one byte, and        /* If the pattern character's value is < 128, we have only one byte, and
2359        can use the fast lookup table. */        can use the fast lookup table. */
# Line 2321  for (;;) Line 2388  for (;;)
2388    
2389      /* Non-UTF-8 mode */      /* Non-UTF-8 mode */
2390        {        {
2391        if (md->end_subject - eptr < 1) RRETURN(MATCH_NOMATCH);        if (md->end_subject - eptr < 1)
2392            {
2393            SCHECK_PARTIAL();            /* This one can use SCHECK_PARTIAL() */
2394            RRETURN(MATCH_NOMATCH);
2395            }
2396        if (md->lcc[ecode[1]] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);        if (md->lcc[ecode[1]] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
2397        ecode += 2;        ecode += 2;
2398        }        }
# Line 2375  for (;;) Line 2446  for (;;)
2446      case OP_MINQUERY:      case OP_MINQUERY:
2447      c = *ecode++ - OP_STAR;      c = *ecode++ - OP_STAR;
2448      minimize = (c & 1) != 0;      minimize = (c & 1) != 0;
2449    
2450      min = rep_min[c];                 /* Pick up values from tables; */      min = rep_min[c];                 /* Pick up values from tables; */
2451      max = rep_max[c];                 /* zero for max => infinity */      max = rep_max[c];                 /* zero for max => infinity */
2452      if (max == 0) max = INT_MAX;      if (max == 0) max = INT_MAX;
# Line 2427  for (;;) Line 2499  for (;;)
2499              {              {
2500              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22);
2501              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2502              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
2503              if (eptr <= md->end_subject - length &&              if (eptr <= md->end_subject - length &&
2504                memcmp(eptr, charptr, length) == 0) eptr += length;                memcmp(eptr, charptr, length) == 0) eptr += length;
2505  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2463  for (;;) Line 2531  for (;;)
2531              else break;              else break;
2532              }              }
2533    
           CHECK_PARTIAL();  
2534            if (possessive) continue;            if (possessive) continue;
2535    
2536            for(;;)            for(;;)
# Line 2492  for (;;) Line 2559  for (;;)
2559      /* When not in UTF-8 mode, load a single-byte character. */      /* When not in UTF-8 mode, load a single-byte character. */
2560    
2561      fc = *ecode++;      fc = *ecode++;
2562    
2563      /* The value of fc at this point is always less than 256, though we may or      /* The value of fc at this point is always less than 256, though we may or
2564      may not be in UTF-8 mode. The code is duplicated for the caseless and      may not be in UTF-8 mode. The code is duplicated for the caseless and
2565      caseful cases, for speed, since matching characters is likely to be quite      caseful cases, for speed, since matching characters is likely to be quite
# Line 2524  for (;;) Line 2591  for (;;)
2591            {            {
2592            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24);
2593            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2594            if (fi >= max)            if (fi >= max) RRETURN(MATCH_NOMATCH);
             {  
             CHECK_PARTIAL();  
             RRETURN(MATCH_NOMATCH);  
             }  
2595            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
2596              {              {
2597              SCHECK_PARTIAL();              SCHECK_PARTIAL();
# Line 2547  for (;;) Line 2610  for (;;)
2610            eptr++;            eptr++;
2611            }            }
2612    
         CHECK_PARTIAL();  
2613          if (possessive) continue;          if (possessive) continue;
2614    
2615          while (eptr >= pp)          while (eptr >= pp)
# Line 2574  for (;;) Line 2636  for (;;)
2636            }            }
2637          if (fc != *eptr++) RRETURN(MATCH_NOMATCH);          if (fc != *eptr++) RRETURN(MATCH_NOMATCH);
2638          }          }
2639    
2640        if (min == max) continue;        if (min == max) continue;
2641    
2642        if (minimize)        if (minimize)
2643          {          {
2644          for (fi = min;; fi++)          for (fi = min;; fi++)
2645            {            {
2646            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26);
2647            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2648            if (fi >= max)            if (fi >= max) RRETURN(MATCH_NOMATCH);
             {  
             CHECK_PARTIAL();  
             RRETURN(MATCH_NOMATCH);  
             }  
2649            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
2650              {              {
2651              SCHECK_PARTIAL();              SCHECK_PARTIAL();
# Line 2603  for (;;) Line 2663  for (;;)
2663            if (eptr >= md->end_subject || fc != *eptr) break;            if (eptr >= md->end_subject || fc != *eptr) break;
2664            eptr++;            eptr++;
2665            }            }
         CHECK_PARTIAL();  
2666          if (possessive) continue;          if (possessive) continue;
2667    
2668          while (eptr >= pp)          while (eptr >= pp)
2669            {            {
2670            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM27);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM27);
# Line 2620  for (;;) Line 2680  for (;;)
2680      checking can be multibyte. */      checking can be multibyte. */
2681    
2682      case OP_NOT:      case OP_NOT:
2683      if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);      if (eptr >= md->end_subject)
2684          {
2685          SCHECK_PARTIAL();
2686          RRETURN(MATCH_NOMATCH);
2687          }
2688      ecode++;      ecode++;
2689      GETCHARINCTEST(c, eptr);      GETCHARINCTEST(c, eptr);
2690      if ((ims & PCRE_CASELESS) != 0)      if ((ims & PCRE_CASELESS) != 0)
# Line 2763  for (;;) Line 2827  for (;;)
2827              {              {
2828              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28);
2829              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2830              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
2831              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
2832                {                {
2833                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 2786  for (;;) Line 2846  for (;;)
2846              {              {
2847              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29);
2848              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2849              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
2850              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
2851                {                {
2852                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 2822  for (;;) Line 2878  for (;;)
2878              if (fc == d) break;              if (fc == d) break;
2879              eptr += len;              eptr += len;
2880              }              }
         CHECK_PARTIAL();  
2881          if (possessive) continue;          if (possessive) continue;
2882          for(;;)          for(;;)
2883              {              {
# Line 2841  for (;;) Line 2896  for (;;)
2896              if (eptr >= md->end_subject || fc == md->lcc[*eptr]) break;              if (eptr >= md->end_subject || fc == md->lcc[*eptr]) break;
2897              eptr++;              eptr++;
2898              }              }
           CHECK_PARTIAL();  
2899            if (possessive) continue;            if (possessive) continue;
2900            while (eptr >= pp)            while (eptr >= pp)
2901              {              {
# Line 2904  for (;;) Line 2958  for (;;)
2958              {              {
2959              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32);
2960              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2961              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
2962              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
2963                {                {
2964                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 2926  for (;;) Line 2976  for (;;)
2976              {              {
2977              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33);
2978              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2979              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
2980              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
2981                {                {
2982                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 2961  for (;;) Line 3007  for (;;)
3007              if (fc == d) break;              if (fc == d) break;
3008              eptr += len;              eptr += len;
3009              }              }
           CHECK_PARTIAL();  
3010            if (possessive) continue;            if (possessive) continue;
3011            for(;;)            for(;;)
3012              {              {
# Line 2980  for (;;) Line 3025  for (;;)
3025              if (eptr >= md->end_subject || fc == *eptr) break;              if (eptr >= md->end_subject || fc == *eptr) break;
3026              eptr++;              eptr++;
3027              }              }
           CHECK_PARTIAL();  
3028            if (possessive) continue;            if (possessive) continue;
3029            while (eptr >= pp)            while (eptr >= pp)
3030              {              {
# Line 3486  for (;;) Line 3530  for (;;)
3530          break;          break;
3531    
3532          case OP_ALLANY:          case OP_ALLANY:
3533          if (eptr > md->end_subject - min) RRETURN(MATCH_NOMATCH);          if (eptr > md->end_subject - min)
3534              {
3535              SCHECK_PARTIAL();
3536              RRETURN(MATCH_NOMATCH);
3537              }
3538          eptr += min;          eptr += min;
3539          break;          break;
3540    
3541          case OP_ANYBYTE:          case OP_ANYBYTE:
3542          if (eptr > md->end_subject - min) RRETURN(MATCH_NOMATCH);          if (eptr > md->end_subject - min)
3543              {
3544              SCHECK_PARTIAL();
3545              RRETURN(MATCH_NOMATCH);
3546              }
3547          eptr += min;          eptr += min;
3548          break;          break;
3549    
# Line 3700  for (;;) Line 3752  for (;;)
3752              {              {
3753              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36);
3754              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3755              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
3756              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
3757                {                {
3758                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 3720  for (;;) Line 3768  for (;;)
3768              {              {
3769              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37);
3770              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3771              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
3772              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
3773                {                {
3774                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 3744  for (;;) Line 3788  for (;;)
3788              {              {
3789              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38);
3790              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3791              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
3792              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
3793                {                {
3794                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 3766  for (;;) Line 3806  for (;;)
3806              {              {
3807              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
3808              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3809              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
3810              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
3811                {                {
3812                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 3788  for (;;) Line 3824  for (;;)
3824              {              {
3825              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40);
3826              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3827              if (fi >= max)              if (fi >= max) RRETURN(MATCH_NOMATCH);
               {  
               CHECK_PARTIAL();  
               RRETURN(MATCH_NOMATCH);  
               }  
3828              if (eptr >= md->end_subject)              if (eptr >= md->end_subject)
3829                {                {
3830                SCHECK_PARTIAL();                SCHECK_PARTIAL();
# Line 3819  for (;;) Line 3851  for (;;)
3851            {            {
3852            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41);
3853            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3854            if (fi >= max)            if (fi >= max) RRETURN(MATCH_NOMATCH);
             {  
             CHECK_PARTIAL();  
             RRETURN(MATCH_NOMATCH);  
             }  
3855            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
3856              {              {
3857              SCHECK_PARTIAL();              SCHECK_PARTIAL();
# Line 3855  for (;;) Line 3883  for (;;)
3883            {            {
3884            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42);
3885            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3886            if (fi >= max)            if (fi >= max) RRETURN(MATCH_NOMATCH);
             {  
             CHECK_PARTIAL();  
             RRETURN(MATCH_NOMATCH);  
             }  
3887            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
3888              {              {
3889              SCHECK_PARTIAL();              SCHECK_PARTIAL();
# Line 4022  for (;;) Line 4046  for (;;)
4046            {            {
4047            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43);
4048            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
4049            if (fi >= max)            if (fi >= max) RRETURN(MATCH_NOMATCH);
             {  
             CHECK_PARTIAL();  
             RRETURN(MATCH_NOMATCH);  
             }  
4050            if (eptr >= md->end_subject)            if (eptr >= md->end_subject)
4051              {              {
4052              SCHECK_PARTIAL();              SCHECK_PARTIAL();
# Line 4222  for (;;) Line 4242  for (;;)
4242    
4243          /* eptr is now past the end of the maximum run */          /* eptr is now past the end of the maximum run */
4244    
         CHECK_PARTIAL();  
4245          if (possessive) continue;          if (possessive) continue;
4246          for(;;)          for(;;)
4247            {            {
# Line 4259  for (;;) Line 4278  for (;;)
4278    
4279          /* eptr is now past the end of the maximum run */          /* eptr is now past the end of the maximum run */
4280    
         CHECK_PARTIAL();  
4281          if (possessive) continue;          if (possessive) continue;
4282          for(;;)          for(;;)
4283            {            {
# Line 4496  for (;;) Line 4514  for (;;)
4514    
4515          /* eptr is now past the end of the maximum run */          /* eptr is now past the end of the maximum run */
4516    
         CHECK_PARTIAL();  
4517          if (possessive) continue;          if (possessive) continue;
4518          for(;;)          for(;;)
4519            {            {
# Line 4652  for (;;) Line 4669  for (;;)
4669    
4670          /* eptr is now past the end of the maximum run */          /* eptr is now past the end of the maximum run */
4671    
         CHECK_PARTIAL();  
4672          if (possessive) continue;          if (possessive) continue;
4673          while (eptr >= pp)          while (eptr >= pp)
4674            {            {
# Line 5267  for(;;) Line 5283  for(;;)
5283    first starting point for which a partial match was found. */    first starting point for which a partial match was found. */
5284    
5285    md->start_match_ptr = start_match;    md->start_match_ptr = start_match;
5286      md->start_used_ptr = start_match;
5287    md->match_call_count = 0;    md->match_call_count = 0;
5288    rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0);    rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0);
5289    if (md->hitend && start_partial == NULL) start_partial = start_match;    if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr;
5290    
5291    switch(rc)    switch(rc)
5292      {      {

Legend:
Removed from v.427  
changed lines
  Added in v.435

  ViewVC Help
Powered by ViewVC 1.1.5