Changeset 28149 in webkit for trunk/JavaScriptCore/pcre/pcre_exec.cpp
- Timestamp:
- Nov 29, 2007, 3:14:21 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/pcre/pcre_exec.cpp
r28148 r28149 160 160 p points to characters 161 161 length number to print 162 is_subject true if printing from within md ->start_subject162 is_subject true if printing from within md.start_subject 163 163 md pointer to matching data block, if is_subject is true 164 164 … … 166 166 */ 167 167 168 static void pchars(const UChar* p, int length, bool is_subject, MatchData *md)168 static void pchars(const UChar* p, int length, bool is_subject, const MatchData& md) 169 169 { 170 if (is_subject && length > md ->end_subject - p)171 length = md ->end_subject - p;170 if (is_subject && length > md.end_subject - p) 171 length = md.end_subject - p; 172 172 while (length-- > 0) { 173 173 int c; … … 200 200 */ 201 201 202 static bool 203 match_ref(int offset, UChar* eptr, int length, MatchData *md) 202 static bool match_ref(int offset, UChar* eptr, int length, const MatchData& md) 204 203 { 205 UChar* p = md->start_subject + md->offset_vector[offset];206 204 UChar* p = md.start_subject + md.offset_vector[offset]; 205 207 206 #ifdef DEBUG 208 if (eptr >= md->end_subject) 209 printf("matching subject <null>"); 210 else 211 { 212 printf("matching subject "); 213 pchars(eptr, length, true, md); 214 } 215 printf(" against backref "); 216 pchars(p, length, false, md); 217 printf("\n"); 207 if (eptr >= md.end_subject) 208 printf("matching subject <null>"); 209 else { 210 printf("matching subject "); 211 pchars(eptr, length, true, md); 212 } 213 printf(" against backref "); 214 pchars(p, length, false, md); 215 printf("\n"); 218 216 #endif 219 220 /* Always fail if not enough characters left */ 221 222 if (length > md->end_subject - eptr) return false; 223 224 /* Separate the caselesss case for speed */ 225 226 if (md->caseless) 227 { 228 while (length-- > 0) 229 { 230 UChar c = *p++; 231 int othercase = _pcre_ucp_othercase(c); 232 UChar d = *eptr++; 233 if (c != d && othercase != d) return false; 217 218 /* Always fail if not enough characters left */ 219 220 if (length > md.end_subject - eptr) 221 return false; 222 223 /* Separate the caselesss case for speed */ 224 225 if (md.caseless) { 226 while (length-- > 0) { 227 UChar c = *p++; 228 int othercase = _pcre_ucp_othercase(c); 229 UChar d = *eptr++; 230 if (c != d && othercase != d) 231 return false; 232 } 234 233 } 235 } 236 else 237 { while (length-- > 0) if (*p++ != *eptr++) return false; } 238 239 return true; 234 else { 235 while (length-- > 0) 236 if (*p++ != *eptr++) 237 return false; 238 } 239 240 return true; 240 241 } 241 242 242 243 243 … … 408 408 } 409 409 410 static int match(UChar* eptr, const uschar* ecode, int offset_top, MatchData *md)410 static int match(UChar* eptr, const uschar* ecode, int offset_top, MatchData& md) 411 411 { 412 412 int is_match = false; … … 464 464 haven't exceeded the recursive call limit. */ 465 465 466 if (md ->match_call_count++ >= MATCH_LIMIT)466 if (md.match_call_count++ >= MATCH_LIMIT) 467 467 return matchError(JSRegExpErrorMatchLimit, stack); 468 468 if (rdepth >= MATCH_LIMIT_RECURSION) … … 524 524 525 525 BEGIN_OPCODE(END): 526 md ->end_match_ptr = stack.currentFrame->eptr; /* Record where we ended */527 md ->end_offset_top = stack.currentFrame->offset_top; /* and how many extracts were taken */526 md.end_match_ptr = stack.currentFrame->eptr; /* Record where we ended */ 527 md.end_offset_top = stack.currentFrame->offset_top; /* and how many extracts were taken */ 528 528 is_match = true; 529 529 RRETURN; … … 550 550 do stack.currentFrame->ecode += GET(stack.currentFrame->ecode,1); while (*stack.currentFrame->ecode == OP_ALT); 551 551 stack.currentFrame->ecode += 1 + LINK_SIZE; 552 stack.currentFrame->offset_top = md ->end_offset_top;552 stack.currentFrame->offset_top = md.end_offset_top; 553 553 NEXT_OPCODE; 554 554 … … 594 594 do stack.currentFrame->ecode += GET(stack.currentFrame->ecode,1); while (*stack.currentFrame->ecode == OP_ALT); 595 595 596 stack.currentFrame->offset_top = md ->end_offset_top;597 stack.currentFrame->eptr = md ->end_match_ptr;596 stack.currentFrame->offset_top = md.end_offset_top; 597 stack.currentFrame->eptr = md.end_match_ptr; 598 598 599 599 /* For a non-repeating ket, just continue at this level. This also … … 681 681 682 682 if (*stack.currentFrame->prev == OP_ASSERT || *stack.currentFrame->prev == OP_ASSERT_NOT || *stack.currentFrame->prev == OP_ONCE) { 683 md ->end_match_ptr = stack.currentFrame->eptr; /* For ONCE */684 md ->end_offset_top = stack.currentFrame->offset_top;683 md.end_match_ptr = stack.currentFrame->eptr; /* For ONCE */ 684 md.end_offset_top = stack.currentFrame->offset_top; 685 685 is_match = true; 686 686 RRETURN; … … 711 711 712 712 if (stack.currentFrame->number > 0) { 713 if (stack.currentFrame->offset >= md ->offset_max)714 md ->offset_overflow = true;713 if (stack.currentFrame->offset >= md.offset_max) 714 md.offset_overflow = true; 715 715 else { 716 md ->offset_vector[stack.currentFrame->offset] =717 md ->offset_vector[md->offset_end - stack.currentFrame->number];718 md ->offset_vector[stack.currentFrame->offset+1] = stack.currentFrame->eptr - md->start_subject;716 md.offset_vector[stack.currentFrame->offset] = 717 md.offset_vector[md.offset_end - stack.currentFrame->number]; 718 md.offset_vector[stack.currentFrame->offset+1] = stack.currentFrame->eptr - md.start_subject; 719 719 if (stack.currentFrame->offset_top <= stack.currentFrame->offset) 720 720 stack.currentFrame->offset_top = stack.currentFrame->offset + 2; … … 756 756 757 757 BEGIN_OPCODE(CIRC): 758 if (stack.currentFrame->eptr != md ->start_subject && (!md->multiline || !isNewline(stack.currentFrame->eptr[-1])))758 if (stack.currentFrame->eptr != md.start_subject && (!md.multiline || !isNewline(stack.currentFrame->eptr[-1]))) 759 759 RRETURN_NO_MATCH; 760 760 stack.currentFrame->ecode++; … … 764 764 765 765 BEGIN_OPCODE(DOLL): 766 if (stack.currentFrame->eptr < md ->end_subject && (!md->multiline || !isNewline(*stack.currentFrame->eptr)))766 if (stack.currentFrame->eptr < md.end_subject && (!md.multiline || !isNewline(*stack.currentFrame->eptr))) 767 767 RRETURN_NO_MATCH; 768 768 stack.currentFrame->ecode++; … … 777 777 be "non-word" characters. */ 778 778 779 if (stack.currentFrame->eptr == md ->start_subject)779 if (stack.currentFrame->eptr == md.start_subject) 780 780 prev_is_word = false; 781 781 else { … … 784 784 lastptr--; 785 785 getChar(c, lastptr); 786 prev_is_word = c < 128 && (md ->ctypes[c] & ctype_word) != 0;787 } 788 if (stack.currentFrame->eptr >= md ->end_subject)786 prev_is_word = c < 128 && (md.ctypes[c] & ctype_word) != 0; 787 } 788 if (stack.currentFrame->eptr >= md.end_subject) 789 789 cur_is_word = false; 790 790 else { 791 791 getChar(c, stack.currentFrame->eptr); 792 cur_is_word = c < 128 && (md ->ctypes[c] & ctype_word) != 0;792 cur_is_word = c < 128 && (md.ctypes[c] & ctype_word) != 0; 793 793 } 794 794 … … 802 802 803 803 BEGIN_OPCODE(ANY): 804 if (stack.currentFrame->eptr < md ->end_subject && isNewline(*stack.currentFrame->eptr))805 RRETURN_NO_MATCH; 806 if (stack.currentFrame->eptr++ >= md ->end_subject)807 RRETURN_NO_MATCH; 808 while (stack.currentFrame->eptr < md ->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))804 if (stack.currentFrame->eptr < md.end_subject && isNewline(*stack.currentFrame->eptr)) 805 RRETURN_NO_MATCH; 806 if (stack.currentFrame->eptr++ >= md.end_subject) 807 RRETURN_NO_MATCH; 808 while (stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) 809 809 stack.currentFrame->eptr++; 810 810 stack.currentFrame->ecode++; … … 812 812 813 813 BEGIN_OPCODE(NOT_DIGIT): 814 if (stack.currentFrame->eptr >= md ->end_subject)814 if (stack.currentFrame->eptr >= md.end_subject) 815 815 RRETURN_NO_MATCH; 816 816 GETCHARINCTEST(c, stack.currentFrame->eptr); … … 821 821 822 822 BEGIN_OPCODE(DIGIT): 823 if (stack.currentFrame->eptr >= md ->end_subject)823 if (stack.currentFrame->eptr >= md.end_subject) 824 824 RRETURN_NO_MATCH; 825 825 GETCHARINCTEST(c, stack.currentFrame->eptr); … … 830 830 831 831 BEGIN_OPCODE(NOT_WHITESPACE): 832 if (stack.currentFrame->eptr >= md ->end_subject)832 if (stack.currentFrame->eptr >= md.end_subject) 833 833 RRETURN_NO_MATCH; 834 834 GETCHARINCTEST(c, stack.currentFrame->eptr); 835 if (c < 128 && (md ->ctypes[c] & ctype_space))835 if (c < 128 && (md.ctypes[c] & ctype_space)) 836 836 RRETURN_NO_MATCH; 837 837 stack.currentFrame->ecode++; … … 839 839 840 840 BEGIN_OPCODE(WHITESPACE): 841 if (stack.currentFrame->eptr >= md ->end_subject)841 if (stack.currentFrame->eptr >= md.end_subject) 842 842 RRETURN_NO_MATCH; 843 843 GETCHARINCTEST(c, stack.currentFrame->eptr); 844 if (c >= 128 || !(md ->ctypes[c] & ctype_space))844 if (c >= 128 || !(md.ctypes[c] & ctype_space)) 845 845 RRETURN_NO_MATCH; 846 846 stack.currentFrame->ecode++; … … 848 848 849 849 BEGIN_OPCODE(NOT_WORDCHAR): 850 if (stack.currentFrame->eptr >= md ->end_subject)850 if (stack.currentFrame->eptr >= md.end_subject) 851 851 RRETURN_NO_MATCH; 852 852 GETCHARINCTEST(c, stack.currentFrame->eptr); 853 if (c < 128 && (md ->ctypes[c] & ctype_word))853 if (c < 128 && (md.ctypes[c] & ctype_word)) 854 854 RRETURN_NO_MATCH; 855 855 stack.currentFrame->ecode++; … … 857 857 858 858 BEGIN_OPCODE(WORDCHAR): 859 if (stack.currentFrame->eptr >= md ->end_subject)859 if (stack.currentFrame->eptr >= md.end_subject) 860 860 RRETURN_NO_MATCH; 861 861 GETCHARINCTEST(c, stack.currentFrame->eptr); 862 if (c >= 128 || !(md ->ctypes[c] & ctype_word))862 if (c >= 128 || !(md.ctypes[c] & ctype_word)) 863 863 RRETURN_NO_MATCH; 864 864 stack.currentFrame->ecode++; … … 882 882 minima. */ 883 883 884 if (stack.currentFrame->offset >= stack.currentFrame->offset_top || md ->offset_vector[stack.currentFrame->offset] < 0)884 if (stack.currentFrame->offset >= stack.currentFrame->offset_top || md.offset_vector[stack.currentFrame->offset] < 0) 885 885 stack.currentFrame->length = 0; 886 886 else 887 stack.currentFrame->length = md ->offset_vector[stack.currentFrame->offset+1] - md->offset_vector[stack.currentFrame->offset];887 stack.currentFrame->length = md.offset_vector[stack.currentFrame->offset+1] - md.offset_vector[stack.currentFrame->offset]; 888 888 889 889 /* Set up for repetition, or handle the non-repeated case */ … … 1023 1023 1024 1024 for (i = 1; i <= min; i++) { 1025 if (stack.currentFrame->eptr >= md ->end_subject)1025 if (stack.currentFrame->eptr >= md.end_subject) 1026 1026 RRETURN_NO_MATCH; 1027 1027 GETCHARINC(c, stack.currentFrame->eptr); … … 1049 1049 if (is_match) 1050 1050 RRETURN; 1051 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md ->end_subject)1051 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject) 1052 1052 RRETURN; 1053 1053 GETCHARINC(c, stack.currentFrame->eptr); … … 1069 1069 for (i = min; i < stack.currentFrame->max; i++) { 1070 1070 int len = 1; 1071 if (stack.currentFrame->eptr >= md ->end_subject)1071 if (stack.currentFrame->eptr >= md.end_subject) 1072 1072 break; 1073 1073 GETCHARLEN(c, stack.currentFrame->eptr, len); … … 1133 1133 1134 1134 for (i = 1; i <= min; i++) { 1135 if (stack.currentFrame->eptr >= md ->end_subject)1135 if (stack.currentFrame->eptr >= md.end_subject) 1136 1136 RRETURN_NO_MATCH; 1137 1137 GETCHARINC(c, stack.currentFrame->eptr); … … 1154 1154 if (is_match) 1155 1155 RRETURN; 1156 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md ->end_subject)1156 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject) 1157 1157 RRETURN; 1158 1158 GETCHARINC(c, stack.currentFrame->eptr); … … 1169 1169 for (i = min; i < stack.currentFrame->max; i++) { 1170 1170 int len = 1; 1171 if (stack.currentFrame->eptr >= md ->end_subject)1171 if (stack.currentFrame->eptr >= md.end_subject) 1172 1172 break; 1173 1173 GETCHARLEN(c, stack.currentFrame->eptr, len); … … 1198 1198 int dc; 1199 1199 stack.currentFrame->ecode += stack.currentFrame->length; 1200 switch (md ->end_subject - stack.currentFrame->eptr) {1200 switch (md.end_subject - stack.currentFrame->eptr) { 1201 1201 case 0: 1202 1202 RRETURN_NO_MATCH; … … 1221 1221 getUTF8CharAndIncrementLength(stack.currentFrame->fc, stack.currentFrame->ecode, stack.currentFrame->length); 1222 1222 1223 if (md ->end_subject - stack.currentFrame->eptr == 0)1223 if (md.end_subject - stack.currentFrame->eptr == 0) 1224 1224 RRETURN_NO_MATCH; 1225 1225 1226 1226 { 1227 1227 int dc; 1228 if (md ->end_subject - stack.currentFrame->eptr == 1) {1228 if (md.end_subject - stack.currentFrame->eptr == 1) { 1229 1229 dc = *stack.currentFrame->eptr++; 1230 1230 if (isLeadingSurrogate(dc)) … … 1247 1247 1248 1248 BEGIN_OPCODE(ASCII_CHAR): 1249 if (md ->end_subject == stack.currentFrame->eptr)1249 if (md.end_subject == stack.currentFrame->eptr) 1250 1250 RRETURN_NO_MATCH; 1251 1251 if (*stack.currentFrame->eptr != stack.currentFrame->ecode[1]) … … 1258 1258 1259 1259 BEGIN_OPCODE(ASCII_LETTER_NC): 1260 if (md ->end_subject == stack.currentFrame->eptr)1260 if (md.end_subject == stack.currentFrame->eptr) 1261 1261 RRETURN_NO_MATCH; 1262 1262 if ((*stack.currentFrame->eptr | 0x20) != stack.currentFrame->ecode[1]) … … 1303 1303 stack.currentFrame->length = 1; 1304 1304 getUTF8CharAndIncrementLength(stack.currentFrame->fc, stack.currentFrame->ecode, stack.currentFrame->length); 1305 if (min * (stack.currentFrame->fc > 0xFFFF ? 2 : 1) > md ->end_subject - stack.currentFrame->eptr)1305 if (min * (stack.currentFrame->fc > 0xFFFF ? 2 : 1) > md.end_subject - stack.currentFrame->eptr) 1306 1306 RRETURN_NO_MATCH; 1307 1307 stack.currentFrame->ecode += stack.currentFrame->length; 1308 1308 1309 1309 if (stack.currentFrame->fc <= 0xFFFF) { 1310 int othercase = md ->caseless ? _pcre_ucp_othercase(stack.currentFrame->fc) : -1;1310 int othercase = md.caseless ? _pcre_ucp_othercase(stack.currentFrame->fc) : -1; 1311 1311 1312 1312 for (i = 1; i <= min; i++) { … … 1325 1325 if (is_match) 1326 1326 RRETURN; 1327 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md ->end_subject)1327 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject) 1328 1328 RRETURN; 1329 1329 if (*stack.currentFrame->eptr != stack.currentFrame->fc && *stack.currentFrame->eptr != stack.currentFrame->repeat_othercase) … … 1335 1335 stack.currentFrame->pp = stack.currentFrame->eptr; 1336 1336 for (i = min; i < stack.currentFrame->max; i++) { 1337 if (stack.currentFrame->eptr >= md ->end_subject)1337 if (stack.currentFrame->eptr >= md.end_subject) 1338 1338 break; 1339 1339 if (*stack.currentFrame->eptr != stack.currentFrame->fc && *stack.currentFrame->eptr != othercase) … … 1370 1370 if (is_match) 1371 1371 RRETURN; 1372 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md ->end_subject)1372 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject) 1373 1373 RRETURN; 1374 1374 getChar(nc, stack.currentFrame->eptr); … … 1382 1382 for (i = min; i < stack.currentFrame->max; i++) { 1383 1383 int nc; 1384 if (stack.currentFrame->eptr > md ->end_subject - 2)1384 if (stack.currentFrame->eptr > md.end_subject - 2) 1385 1385 break; 1386 1386 getChar(nc, stack.currentFrame->eptr); … … 1405 1405 1406 1406 BEGIN_OPCODE(NOT): 1407 if (stack.currentFrame->eptr >= md ->end_subject)1407 if (stack.currentFrame->eptr >= md.end_subject) 1408 1408 RRETURN_NO_MATCH; 1409 1409 stack.currentFrame->ecode++; 1410 1410 GETCHARINCTEST(c, stack.currentFrame->eptr); 1411 if (md ->caseless) {1411 if (md.caseless) { 1412 1412 if (c < 128) 1413 c = md ->lcc[c];1414 if (md ->lcc[*stack.currentFrame->ecode++] == c)1413 c = md.lcc[c]; 1414 if (md.lcc[*stack.currentFrame->ecode++] == c) 1415 1415 RRETURN_NO_MATCH; 1416 1416 } else { … … 1458 1458 1459 1459 REPEATNOTCHAR: 1460 if (min > md ->end_subject - stack.currentFrame->eptr)1460 if (min > md.end_subject - stack.currentFrame->eptr) 1461 1461 RRETURN_NO_MATCH; 1462 1462 stack.currentFrame->fc = *stack.currentFrame->ecode++; … … 1472 1472 DPRINTF(("negative matching %c{%d,%d}\n", stack.currentFrame->fc, min, stack.currentFrame->max)); 1473 1473 1474 if (md ->caseless) {1474 if (md.caseless) { 1475 1475 if (stack.currentFrame->fc < 128) 1476 stack.currentFrame->fc = md ->lcc[stack.currentFrame->fc];1476 stack.currentFrame->fc = md.lcc[stack.currentFrame->fc]; 1477 1477 1478 1478 { … … 1481 1481 GETCHARINC(d, stack.currentFrame->eptr); 1482 1482 if (d < 128) 1483 d = md ->lcc[d];1483 d = md.lcc[d]; 1484 1484 if (stack.currentFrame->fc == d) 1485 1485 RRETURN_NO_MATCH; … … 1498 1498 GETCHARINC(d, stack.currentFrame->eptr); 1499 1499 if (d < 128) 1500 d = md ->lcc[d];1501 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md ->end_subject || stack.currentFrame->fc == d)1500 d = md.lcc[d]; 1501 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject || stack.currentFrame->fc == d) 1502 1502 RRETURN; 1503 1503 } … … 1514 1514 for (i = min; i < stack.currentFrame->max; i++) { 1515 1515 int len = 1; 1516 if (stack.currentFrame->eptr >= md ->end_subject)1516 if (stack.currentFrame->eptr >= md.end_subject) 1517 1517 break; 1518 1518 GETCHARLEN(d, stack.currentFrame->eptr, len); 1519 1519 if (d < 128) 1520 d = md ->lcc[d];1520 d = md.lcc[d]; 1521 1521 if (stack.currentFrame->fc == d) 1522 1522 break; … … 1560 1560 RRETURN; 1561 1561 GETCHARINC(d, stack.currentFrame->eptr); 1562 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md ->end_subject || stack.currentFrame->fc == d)1562 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject || stack.currentFrame->fc == d) 1563 1563 RRETURN; 1564 1564 } … … 1575 1575 for (i = min; i < stack.currentFrame->max; i++) { 1576 1576 int len = 1; 1577 if (stack.currentFrame->eptr >= md ->end_subject)1577 if (stack.currentFrame->eptr >= md.end_subject) 1578 1578 break; 1579 1579 GETCHARLEN(d, stack.currentFrame->eptr, len); … … 1643 1643 and single-bytes. */ 1644 1644 1645 if (min > md ->end_subject - stack.currentFrame->eptr)1645 if (min > md.end_subject - stack.currentFrame->eptr) 1646 1646 RRETURN_NO_MATCH; 1647 1647 if (min > 0) { … … 1649 1649 case OP_ANY: 1650 1650 for (i = 1; i <= min; i++) { 1651 if (stack.currentFrame->eptr >= md ->end_subject || isNewline(*stack.currentFrame->eptr))1651 if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr)) 1652 1652 RRETURN_NO_MATCH; 1653 1653 ++stack.currentFrame->eptr; 1654 while (stack.currentFrame->eptr < md ->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))1654 while (stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) 1655 1655 stack.currentFrame->eptr++; 1656 1656 } … … 1659 1659 case OP_NOT_DIGIT: 1660 1660 for (i = 1; i <= min; i++) { 1661 if (stack.currentFrame->eptr >= md ->end_subject)1661 if (stack.currentFrame->eptr >= md.end_subject) 1662 1662 RRETURN_NO_MATCH; 1663 1663 GETCHARINC(c, stack.currentFrame->eptr); … … 1669 1669 case OP_DIGIT: 1670 1670 for (i = 1; i <= min; i++) { 1671 if (stack.currentFrame->eptr >= md ->end_subject || !isASCIIDigit(*stack.currentFrame->eptr++))1671 if (stack.currentFrame->eptr >= md.end_subject || !isASCIIDigit(*stack.currentFrame->eptr++)) 1672 1672 RRETURN_NO_MATCH; 1673 1673 /* No need to skip more bytes - we know it's a 1-byte character */ … … 1677 1677 case OP_NOT_WHITESPACE: 1678 1678 for (i = 1; i <= min; i++) { 1679 if (stack.currentFrame->eptr >= md ->end_subject ||1680 (*stack.currentFrame->eptr < 128 && (md ->ctypes[*stack.currentFrame->eptr] & ctype_space) != 0))1679 if (stack.currentFrame->eptr >= md.end_subject || 1680 (*stack.currentFrame->eptr < 128 && (md.ctypes[*stack.currentFrame->eptr] & ctype_space) != 0)) 1681 1681 RRETURN_NO_MATCH; 1682 while (++stack.currentFrame->eptr < md ->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }1682 while (++stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { } 1683 1683 } 1684 1684 break; … … 1686 1686 case OP_WHITESPACE: 1687 1687 for (i = 1; i <= min; i++) { 1688 if (stack.currentFrame->eptr >= md ->end_subject ||1689 *stack.currentFrame->eptr >= 128 || (md ->ctypes[*stack.currentFrame->eptr++] & ctype_space) == 0)1688 if (stack.currentFrame->eptr >= md.end_subject || 1689 *stack.currentFrame->eptr >= 128 || (md.ctypes[*stack.currentFrame->eptr++] & ctype_space) == 0) 1690 1690 RRETURN_NO_MATCH; 1691 1691 /* No need to skip more bytes - we know it's a 1-byte character */ … … 1695 1695 case OP_NOT_WORDCHAR: 1696 1696 for (i = 1; i <= min; i++) { 1697 if (stack.currentFrame->eptr >= md ->end_subject ||1698 (*stack.currentFrame->eptr < 128 && (md ->ctypes[*stack.currentFrame->eptr] & ctype_word) != 0))1697 if (stack.currentFrame->eptr >= md.end_subject || 1698 (*stack.currentFrame->eptr < 128 && (md.ctypes[*stack.currentFrame->eptr] & ctype_word) != 0)) 1699 1699 RRETURN_NO_MATCH; 1700 while (++stack.currentFrame->eptr < md ->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }1700 while (++stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { } 1701 1701 } 1702 1702 break; … … 1704 1704 case OP_WORDCHAR: 1705 1705 for (i = 1; i <= min; i++) { 1706 if (stack.currentFrame->eptr >= md ->end_subject ||1707 *stack.currentFrame->eptr >= 128 || (md ->ctypes[*stack.currentFrame->eptr++] & ctype_word) == 0)1706 if (stack.currentFrame->eptr >= md.end_subject || 1707 *stack.currentFrame->eptr >= 128 || (md.ctypes[*stack.currentFrame->eptr++] & ctype_word) == 0) 1708 1708 RRETURN_NO_MATCH; 1709 1709 /* No need to skip more bytes - we know it's a 1-byte character */ … … 1730 1730 if (is_match) 1731 1731 RRETURN; 1732 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md ->end_subject)1732 if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject) 1733 1733 RRETURN; 1734 1734 … … 1751 1751 1752 1752 case OP_NOT_WHITESPACE: 1753 if (c < 128 && (md ->ctypes[c] & ctype_space))1753 if (c < 128 && (md.ctypes[c] & ctype_space)) 1754 1754 RRETURN; 1755 1755 break; 1756 1756 1757 1757 case OP_WHITESPACE: 1758 if (c >= 128 || !(md ->ctypes[c] & ctype_space))1758 if (c >= 128 || !(md.ctypes[c] & ctype_space)) 1759 1759 RRETURN; 1760 1760 break; 1761 1761 1762 1762 case OP_NOT_WORDCHAR: 1763 if (c < 128 && (md ->ctypes[c] & ctype_word))1763 if (c < 128 && (md.ctypes[c] & ctype_word)) 1764 1764 RRETURN; 1765 1765 break; 1766 1766 1767 1767 case OP_WORDCHAR: 1768 if (c >= 128 || !(md ->ctypes[c] & ctype_word))1768 if (c >= 128 || !(md.ctypes[c] & ctype_word)) 1769 1769 RRETURN; 1770 1770 break; … … 1793 1793 if (stack.currentFrame->max < INT_MAX) { 1794 1794 for (i = min; i < stack.currentFrame->max; i++) { 1795 if (stack.currentFrame->eptr >= md ->end_subject || isNewline(*stack.currentFrame->eptr))1795 if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr)) 1796 1796 break; 1797 1797 stack.currentFrame->eptr++; 1798 while (stack.currentFrame->eptr < md ->end_subject && (*stack.currentFrame->eptr & 0xc0) == 0x80)1798 while (stack.currentFrame->eptr < md.end_subject && (*stack.currentFrame->eptr & 0xc0) == 0x80) 1799 1799 stack.currentFrame->eptr++; 1800 1800 } … … 1805 1805 else { 1806 1806 for (i = min; i < stack.currentFrame->max; i++) { 1807 if (stack.currentFrame->eptr >= md ->end_subject || isNewline(*stack.currentFrame->eptr))1807 if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr)) 1808 1808 break; 1809 1809 stack.currentFrame->eptr++; … … 1816 1816 for (i = min; i < stack.currentFrame->max; i++) { 1817 1817 int len = 1; 1818 if (stack.currentFrame->eptr >= md ->end_subject)1818 if (stack.currentFrame->eptr >= md.end_subject) 1819 1819 break; 1820 1820 GETCHARLEN(c, stack.currentFrame->eptr, len); … … 1828 1828 for (i = min; i < stack.currentFrame->max; i++) { 1829 1829 int len = 1; 1830 if (stack.currentFrame->eptr >= md ->end_subject)1830 if (stack.currentFrame->eptr >= md.end_subject) 1831 1831 break; 1832 1832 GETCHARLEN(c, stack.currentFrame->eptr, len); … … 1840 1840 for (i = min; i < stack.currentFrame->max; i++) { 1841 1841 int len = 1; 1842 if (stack.currentFrame->eptr >= md ->end_subject)1842 if (stack.currentFrame->eptr >= md.end_subject) 1843 1843 break; 1844 1844 GETCHARLEN(c, stack.currentFrame->eptr, len); 1845 if (c < 128 && (md ->ctypes[c] & ctype_space))1845 if (c < 128 && (md.ctypes[c] & ctype_space)) 1846 1846 break; 1847 1847 stack.currentFrame->eptr+= len; … … 1852 1852 for (i = min; i < stack.currentFrame->max; i++) { 1853 1853 int len = 1; 1854 if (stack.currentFrame->eptr >= md ->end_subject)1854 if (stack.currentFrame->eptr >= md.end_subject) 1855 1855 break; 1856 1856 GETCHARLEN(c, stack.currentFrame->eptr, len); 1857 if (c >= 128 || !(md ->ctypes[c] & ctype_space))1857 if (c >= 128 || !(md.ctypes[c] & ctype_space)) 1858 1858 break; 1859 1859 stack.currentFrame->eptr+= len; … … 1864 1864 for (i = min; i < stack.currentFrame->max; i++) { 1865 1865 int len = 1; 1866 if (stack.currentFrame->eptr >= md ->end_subject)1866 if (stack.currentFrame->eptr >= md.end_subject) 1867 1867 break; 1868 1868 GETCHARLEN(c, stack.currentFrame->eptr, len); 1869 if (c < 128 && (md ->ctypes[c] & ctype_word))1869 if (c < 128 && (md.ctypes[c] & ctype_word)) 1870 1870 break; 1871 1871 stack.currentFrame->eptr+= len; … … 1876 1876 for (i = min; i < stack.currentFrame->max; i++) { 1877 1877 int len = 1; 1878 if (stack.currentFrame->eptr >= md ->end_subject)1878 if (stack.currentFrame->eptr >= md.end_subject) 1879 1879 break; 1880 1880 GETCHARLEN(c, stack.currentFrame->eptr, len); 1881 if (c >= 128 || !(md ->ctypes[c] & ctype_word))1881 if (c >= 128 || !(md.ctypes[c] & ctype_word)) 1882 1882 break; 1883 1883 stack.currentFrame->eptr+= len; … … 1954 1954 #endif 1955 1955 1956 if (stack.currentFrame->offset < md ->offset_max) {1957 stack.currentFrame->save_offset1 = md ->offset_vector[stack.currentFrame->offset];1958 stack.currentFrame->save_offset2 = md ->offset_vector[stack.currentFrame->offset + 1];1959 stack.currentFrame->save_offset3 = md ->offset_vector[md->offset_end - stack.currentFrame->number];1956 if (stack.currentFrame->offset < md.offset_max) { 1957 stack.currentFrame->save_offset1 = md.offset_vector[stack.currentFrame->offset]; 1958 stack.currentFrame->save_offset2 = md.offset_vector[stack.currentFrame->offset + 1]; 1959 stack.currentFrame->save_offset3 = md.offset_vector[md.offset_end - stack.currentFrame->number]; 1960 1960 1961 1961 DPRINTF(("saving %d %d %d\n", stack.currentFrame->save_offset1, stack.currentFrame->save_offset2, stack.currentFrame->save_offset3)); 1962 md ->offset_vector[md->offset_end - stack.currentFrame->number] = stack.currentFrame->eptr - md->start_subject;1962 md.offset_vector[md.offset_end - stack.currentFrame->number] = stack.currentFrame->eptr - md.start_subject; 1963 1963 1964 1964 do { … … 1970 1970 DPRINTF(("bracket %d failed\n", stack.currentFrame->number)); 1971 1971 1972 md ->offset_vector[stack.currentFrame->offset] = stack.currentFrame->save_offset1;1973 md ->offset_vector[stack.currentFrame->offset + 1] = stack.currentFrame->save_offset2;1974 md ->offset_vector[md->offset_end - stack.currentFrame->number] = stack.currentFrame->save_offset3;1972 md.offset_vector[stack.currentFrame->offset] = stack.currentFrame->save_offset1; 1973 md.offset_vector[stack.currentFrame->offset + 1] = stack.currentFrame->save_offset2; 1974 md.offset_vector[md.offset_end - stack.currentFrame->number] = stack.currentFrame->save_offset3; 1975 1975 1976 1976 RRETURN; … … 2276 2276 const uschar* start_code = (const uschar*)(re + 1); 2277 2277 2278 int returnCode = match(start_match, start_code, 2, &match_block);2278 int returnCode = match(start_match, start_code, 2, match_block); 2279 2279 2280 2280 /* When the result is no match, if the subject's first character was a
Note:
See TracChangeset
for help on using the changeset viewer.