Changeset 28139 in webkit for trunk/JavaScriptCore/pcre/pcre_compile.cpp
- Timestamp:
- Nov 29, 2007, 3:05:07 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/pcre/pcre_compile.cpp
r28138 r28139 469 469 int length = -1; 470 470 471 registerint branchlength = 0;472 registeruschar *cc = code + 1 + LINK_SIZE;471 int branchlength = 0; 472 uschar *cc = code + 1 + LINK_SIZE; 473 473 474 474 /* Scan along the opcodes for this branch. If we get to the end of the … … 478 478 { 479 479 int d; 480 registerint op = *cc;480 int op = *cc; 481 481 if (op >= OP_BRA) op = OP_BRA; 482 482 … … 630 630 could_be_empty_branch(const uschar *code, const uschar *endcode) 631 631 { 632 registerint c;632 int c; 633 633 for (code = first_significant_code(code + 1 + LINK_SIZE, true); 634 634 code < endcode; … … 848 848 int req_caseopt, reqvary, tempreqvary; 849 849 int after_manual_callout = 0; 850 registerint c;851 registeruschar *code = *codeptr;850 int c; 851 uschar *code = *codeptr; 852 852 uschar *tempcode; 853 853 BOOL groupsetfirstbyte = false; … … 1033 1033 if (c < 0) 1034 1034 { 1035 registerconst uschar *cbits = cd->cbits;1035 const uschar *cbits = cd->cbits; 1036 1036 class_charcount += 2; /* Greater than 1 is what matters */ 1037 1037 switch (-c) … … 1116 1116 the pre-pass. Optimize one-character ranges */ 1117 1117 1118 if (d == c) goto LONE_SINGLE_CHARACTER; /* A few lines below */ 1118 if (d == c) 1119 goto LONE_SINGLE_CHARACTER; /* A few lines below */ 1119 1120 1120 1121 /* In UTF-8 mode, if the upper limit is > 255, or > 127 for caseless … … 1613 1614 else if (*previous >= OP_BRA || *previous == OP_ONCE) 1614 1615 { 1615 registerint i;1616 int i; 1616 1617 int ketoffset = 0; 1617 1618 int len = code - previous; … … 1626 1627 if (repeat_max == -1) 1627 1628 { 1628 registeruschar *ket = previous;1629 uschar *ket = previous; 1629 1630 do ket += GET(ket, 1); while (*ket != OP_KET); 1630 1631 ketoffset = code - ket; … … 1834 1835 1835 1836 /* Process nested bracketed re. Assertions may not be repeated, but other 1836 kinds can be. We copy code into a non- registervariable in order to be able1837 kinds can be. We copy code into a non-variable in order to be able 1837 1838 to pass its address because some compilers complain otherwise. Pass in a 1838 1839 new setting for the ims options if they have changed. */ … … 2239 2240 2240 2241 static BOOL 2241 is_anchored( registerconst uschar *code, int options, unsigned int bracket_map,2242 is_anchored(const uschar *code, int options, unsigned int bracket_map, 2242 2243 unsigned int backref_map) 2243 2244 { … … 2245 2246 const uschar *scode = 2246 2247 first_significant_code(code + 1+LINK_SIZE, false); 2247 registerint op = *scode;2248 int op = *scode; 2248 2249 2249 2250 /* Capturing brackets */ … … 2304 2305 do { 2305 2306 const uschar *scode = first_significant_code(code + 1+LINK_SIZE, false); 2306 registerint op = *scode;2307 int op = *scode; 2307 2308 2308 2309 /* Capturing brackets */ … … 2367 2368 find_firstassertedchar(const uschar *code, int options, BOOL inassert) 2368 2369 { 2369 registerint c = -1;2370 int c = -1; 2370 2371 do { 2371 2372 int d; 2372 2373 const uschar *scode = 2373 2374 first_significant_code(code + 1+LINK_SIZE, true); 2374 registerint op = *scode;2375 int op = *scode; 2375 2376 2376 2377 if (op >= OP_BRA) op = OP_BRA; … … 2679 2680 another byte in the UTF-8 representation. */ 2680 2681 2681 if (ignoreCase) 2682 { 2682 if (ignoreCase) { 2683 2683 int occ, ocd; 2684 2684 int cc = c; 2685 2685 int origd = d; 2686 while (get_othercase_range(&cc, origd, &occ, &ocd)) 2687 { 2686 while (get_othercase_range(&cc, origd, &occ, &ocd)) { 2688 2687 if (occ >= c && ocd <= d) continue; /* Skip embedded */ 2689 2688 … … 2718 2717 support. */ 2719 2718 2720 else 2721 { 2722 if ((c > 255 || (ignoreCase && c > 127))) 2723 { 2719 else { 2720 if ((c > 255 || (ignoreCase && c > 127))) { 2724 2721 uschar buffer[6]; 2725 2722 class_optcount = 10; /* Ensure > 1 */ … … 2745 2742 code. Here, we handle repeats for the class opcodes. */ 2746 2743 2747 if (class_optcount == 1) length += 3; else 2748 { 2744 if (class_optcount == 1) 2745 length += 3; 2746 else { 2749 2747 length += 33; 2750 2748 … … 2752 2750 we also need extra for wrapping the whole thing in a sub-pattern. */ 2753 2751 2754 if (ptr + 1 < patternEnd && ptr[1] == '{' && is_counted_repeat(ptr+2, patternEnd)) 2755 { 2752 if (ptr + 1 < patternEnd && ptr[1] == '{' && is_counted_repeat(ptr+2, patternEnd)) { 2756 2753 ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode); 2757 2754 if (errorcode != 0) return -1;; … … 2759 2756 (min == 1 && max == -1)) 2760 2757 length++; 2761 else length += 5;2762 if (ptr + 1 < patternEnd && ptr[1] == '+')2763 {2758 else 2759 length += 5; 2760 if (ptr + 1 < patternEnd && ptr[1] == '+') { 2764 2761 ptr++; 2765 2762 length += 2 + 2*LINK_SIZE; 2766 } 2767 else if (ptr + 1 < patternEnd && ptr[1] == '?')ptr++;2763 } else if (ptr + 1 < patternEnd && ptr[1] == '?') 2764 ptr++; 2768 2765 } 2769 2766 } … … 2779 2776 /* Handle special forms of bracket, which all start (? */ 2780 2777 2781 if (ptr + 1 < patternEnd && ptr[1] == '?') 2782 { 2783 switch (c = (ptr + 2 < patternEnd ? ptr[2] : 0)) 2784 { 2778 if (ptr + 1 < patternEnd && ptr[1] == '?') { 2779 switch (c = (ptr + 2 < patternEnd ? ptr[2] : 0)) { 2785 2780 /* Non-referencing groups and lookaheads just move the pointer on, and 2786 2781 then behave like a non-special bracket, except that they don't increment … … 2843 2838 case ')': 2844 2839 length += 1 + LINK_SIZE; 2845 if (brastackptr > 0) 2846 { 2840 if (brastackptr > 0) { 2847 2841 duplength = length - brastack[--brastackptr]; 2848 2842 branch_extra = bralenstack[brastackptr]; 2849 2843 } 2850 else duplength = 0; 2844 else 2845 duplength = 0; 2851 2846 2852 2847 /* Leave ptr at the final char; for read_repeat_counts this happens 2853 2848 automatically; for the others we need an increment. */ 2854 2849 2855 if (ptr + 1 < patternEnd && (c = ptr[1]) == '{' && is_counted_repeat(ptr+2, patternEnd)) 2856 { 2850 if (ptr + 1 < patternEnd && (c = ptr[1]) == '{' && is_counted_repeat(ptr+2, patternEnd)) { 2857 2851 ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode); 2858 2852 if (errorcode != 0) return -1;; … … 2868 2862 bracket set. */ 2869 2863 2870 if (min == 0) 2871 { 2864 if (min == 0) { 2872 2865 length++; 2873 2866 if (max > 0) length += (max - 1) * (duplength + 3 + 2*LINK_SIZE); … … 2880 2873 but one of the optional copies. */ 2881 2874 2882 else 2883 { 2875 else { 2884 2876 length += (min - 1) * duplength; 2885 2877 if (max > min) /* Need this test as max=-1 means no limit */ … … 2890 2882 /* Allow space for once brackets for "possessive quantifier" */ 2891 2883 2892 if (ptr + 1 < patternEnd && ptr[1] == '+') 2893 { 2884 if (ptr + 1 < patternEnd && ptr[1] == '+') { 2894 2885 ptr++; 2895 2886 length += 2 + 2*LINK_SIZE; … … 2909 2900 /* In UTF-8 mode, check for additional bytes. */ 2910 2901 2911 if (c > 127) 2912 { 2913 if (IS_LEADING_SURROGATE(c)) 2914 { 2915 c = DECODE_SURROGATE_PAIR(c, ptr < patternEnd ? *ptr : 0); 2902 if (c > 127) { 2903 if (isLeadingSurrogate(c)) { 2904 c = decodeSurrogatePair(c, ptr < patternEnd ? *ptr : 0); 2916 2905 ++ptr; 2917 2906 } … … 3139 3128 if (numSubpatterns) 3140 3129 *numSubpatterns = re->top_bracket; 3141 return static_cast<JSRegExp*>(re);3130 return re; 3142 3131 } 3143 3132
Note:
See TracChangeset
for help on using the changeset viewer.