Changeset 27419 in webkit for trunk/JavaScriptCore/kjs/regexp.cpp
- Timestamp:
- Nov 3, 2007, 10:22:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/regexp.cpp
r27320 r27419 34 34 : m_flags(flags), m_constructionError(0), m_numSubPatterns(0) 35 35 { 36 #if USE(PCRE16)36 #if !USE(POSIX_REGEX) 37 37 38 int options = PCRE_UTF8;38 int options = 0; 39 39 if (flags & IgnoreCase) 40 options |= PCRE_CASELESS;40 options |= JS_REGEXP_CASELESS; 41 41 if (flags & Multiline) 42 options |= PCRE_MULTILINE;42 options |= JS_REGEXP_MULTILINE; 43 43 44 44 const char* errorMessage; 45 int errorOffset; 46 m_regex = pcre_compile2(reinterpret_cast<const uint16_t*>(p.data()), p.size(), 47 options, NULL, &errorMessage, &errorOffset, NULL); 45 m_regex = jsRegExpCompile(reinterpret_cast<const JSRegExpChar*>(p.data()), p.size(), options, 46 &m_numSubPatterns, &errorMessage); 48 47 if (!m_regex) { 49 48 m_constructionError = strdup(errorMessage); … … 51 50 } 52 51 53 // Get number of subpatterns that will be returned. 54 pcre_fullinfo(m_regex, NULL, PCRE_INFO_CAPTURECOUNT, &m_numSubPatterns); 55 56 #else /* USE(PCRE16) */ 52 #else /* USE(POSIX_REGEX) */ 57 53 58 54 int regflags = 0; … … 84 80 RegExp::~RegExp() 85 81 { 86 #if USE(PCRE16)87 pcre_free(m_regex);82 #if !USE(POSIX_REGEX) 83 jsRegExpFree(m_regex); 88 84 #else 89 85 /* TODO: is this really okay after an error ? */ … … 103 99 return -1; 104 100 105 #if USE(PCRE16)101 #if !USE(POSIX_REGEX) 106 102 107 103 if (!m_regex) … … 122 118 } 123 119 124 int numMatches = pcre_exec(m_regex, NULL, reinterpret_cast<const uint16_t *>(s.data()), s.size(), i, 0, offsetVector, offsetVectorSize);120 int numMatches = jsRegExpExecute(m_regex, reinterpret_cast<const JSRegExpChar*>(s.data()), s.size(), i, offsetVector, offsetVectorSize); 125 121 126 122 if (numMatches < 0) { 127 123 #ifndef NDEBUG 128 if (numMatches != PCRE_ERROR_NOMATCH)124 if (numMatches != JS_REGEXP_ERROR_NOMATCH) 129 125 fprintf(stderr, "KJS: pcre_exec() failed with result %d\n", numMatches); 130 126 #endif
Note:
See TracChangeset
for help on using the changeset viewer.