Changeset 28151 in webkit
- Timestamp:
- Nov 29, 2007 3:16:01 AM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r28150 r28151 1 2007-11-24 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Sam. 4 5 reformat is_anchored 6 7 * pcre/pcre_compile.cpp: 8 (is_anchored): 9 1 10 2007-11-24 Eric Seidel <eric@webkit.org> 2 11 -
trunk/JavaScriptCore/pcre/pcre_compile.cpp
r28150 r28151 2058 2058 */ 2059 2059 2060 static bool 2061 is_anchored(const uschar *code, int options, unsigned int bracket_map, 2062 unsigned int backref_map) 2060 static bool is_anchored(const uschar* code, int options, unsigned int bracket_map, unsigned int backref_map) 2063 2061 { 2064 do { 2065 const uschar *scode = 2066 first_significant_code(code + 1+LINK_SIZE, false); 2067 int op = *scode; 2068 2069 /* Capturing brackets */ 2070 2071 if (op > OP_BRA) 2072 { 2073 int new_map; 2074 op -= OP_BRA; 2075 if (op > EXTRACT_BASIC_MAX) op = GET2(scode, 2+LINK_SIZE); 2076 new_map = bracket_map | ((op < 32)? (1 << op) : 1); 2077 if (!is_anchored(scode, options, new_map, backref_map)) return false; 2078 } 2079 2080 /* Other brackets */ 2081 2082 else if (op == OP_BRA || op == OP_ASSERT || op == OP_ONCE) 2083 { 2084 if (!is_anchored(scode, options, bracket_map, backref_map)) return false; 2085 } 2086 2087 /* Check for explicit anchoring */ 2088 2089 else if (((options & PCRE_MULTILINE) != 0 || op != OP_CIRC)) 2090 return false; 2091 code += GET(code, 1); 2092 } 2093 while (*code == OP_ALT); /* Loop for each alternative */ 2094 return true; 2062 do { 2063 const uschar *scode = 2064 first_significant_code(code + 1 + LINK_SIZE, false); 2065 int op = *scode; 2066 2067 /* Capturing brackets */ 2068 if (op > OP_BRA) { 2069 op -= OP_BRA; 2070 if (op > EXTRACT_BASIC_MAX) 2071 op = GET2(scode, 2 + LINK_SIZE); 2072 int new_map = bracket_map | ((op < 32)? (1 << op) : 1); 2073 if (!is_anchored(scode, options, new_map, backref_map)) 2074 return false; 2075 } 2076 2077 /* Other brackets */ 2078 else if (op == OP_BRA || op == OP_ASSERT || op == OP_ONCE) 2079 if (!is_anchored(scode, options, bracket_map, backref_map)) 2080 return false; 2081 2082 /* Check for explicit anchoring */ 2083 2084 else if ((options & PCRE_MULTILINE) || op != OP_CIRC) 2085 return false; 2086 code += GET(code, 1); 2087 } while (*code == OP_ALT); /* Loop for each alternative */ 2088 return true; 2095 2089 } 2096 2090
Note: See TracChangeset
for help on using the changeset viewer.