Changeset 244694 in webkit
- Timestamp:
- Apr 26, 2019 9:51:48 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/tests/testapi.cpp
r236805 r244694 37 37 #include <wtf/NumberOfCores.h> 38 38 #include <wtf/Vector.h> 39 #include <wtf/text/StringCommon.h> 39 40 40 41 extern "C" int testCAPIViaCpp(const char* filter); … … 485 486 Deque<RefPtr<SharedTask<void(TestAPI&)>>> tasks; 486 487 487 #if OS(DARWIN)488 488 auto shouldRun = [&] (const char* testName) -> bool { 489 return !filter || !!strcasestr(testName, filter);489 return !filter || WTF::findIgnoringASCIICaseWithoutLength(testName, filter) != WTF::notFound; 490 490 }; 491 #else492 auto shouldRun = [] (const char*) -> bool { return true; };493 #endif494 491 495 492 RUN(basicSymbol()); -
trunk/Source/JavaScriptCore/ChangeLog
r244676 r244694 1 2019-04-26 Don Olmstead <don.olmstead@sony.com> 2 3 Add WTF::findIgnoringASCIICaseWithoutLength to replace strcasestr 4 https://bugs.webkit.org/show_bug.cgi?id=197291 5 6 Reviewed by Konstantin Tokarev. 7 8 Replace uses of strcasestr with WTF::findIgnoringASCIICaseWithoutLength. 9 10 * API/tests/testapi.cpp: 11 * assembler/testmasm.cpp: 12 * b3/air/testair.cpp: 13 * b3/testb3.cpp: 14 * dfg/testdfg.cpp: 15 * dynbench.cpp: 16 1 17 2019-04-25 Fujii Hironori <Hironori.Fujii@sony.com> 2 18 -
trunk/Source/JavaScriptCore/assembler/testmasm.cpp
r242109 r244694 41 41 #include <wtf/NumberOfCores.h> 42 42 #include <wtf/Threading.h> 43 #include <wtf/text/StringCommon.h> 43 44 44 45 // We don't have a NO_RETURN_DUE_TO_EXIT, nor should we. That's ridiculous. … … 956 957 957 958 auto shouldRun = [&] (const char* testName) -> bool { 958 #if OS(UNIX) 959 return !filter || !!strcasestr(testName, filter); 960 #else 961 return !filter || !!strstr(testName, filter); 962 #endif 959 return !filter || WTF::findIgnoringASCIICaseWithoutLength(testName, filter) != WTF::notFound; 963 960 }; 964 961 -
trunk/Source/JavaScriptCore/b3/air/testair.cpp
r242068 r244694 46 46 #include <wtf/StdMap.h> 47 47 #include <wtf/Threading.h> 48 #include <wtf/text/StringCommon.h> 48 49 49 50 // We don't have a NO_RETURN_DUE_TO_EXIT, nor should we. That's ridiculous. … … 2082 2083 2083 2084 auto shouldRun = [&] (const char* testName) -> bool { 2084 return !filter || !!strcasestr(testName, filter);2085 return !filter || WTF::findIgnoringASCIICaseWithoutLength(testName, filter) != WTF::notFound; 2085 2086 }; 2086 2087 -
trunk/Source/JavaScriptCore/b3/testb3.cpp
r244309 r244694 79 79 #include <wtf/StdList.h> 80 80 #include <wtf/Threading.h> 81 #include <wtf/text/StringCommon.h> 81 82 82 83 // We don't have a NO_RETURN_DUE_TO_EXIT, nor should we. That's ridiculous. … … 17157 17158 17158 17159 auto shouldRun = [&] (const char* testName) -> bool { 17159 return !filter || !!strcasestr(testName, filter);17160 return !filter || WTF::findIgnoringASCIICaseWithoutLength(testName, filter) != WTF::notFound; 17160 17161 }; 17161 17162 -
trunk/Source/JavaScriptCore/dfg/testdfg.cpp
r243278 r244694 32 32 #include "InitializeThreading.h" 33 33 #include <wtf/DataLog.h> 34 #include <wtf/text/StringCommon.h> 34 35 35 36 // We don't have a NO_RETURN_DUE_TO_EXIT, nor should we. That's ridiculous. … … 81 82 { 82 83 auto shouldRun = [&] (const char* testName) -> bool { 83 return !filter || !!strcasestr(testName, filter);84 return !filter || WTF::findIgnoringASCIICaseWithoutLength(testName, filter) != WTF::notFound; 84 85 }; 85 86 -
trunk/Source/JavaScriptCore/dynbench.cpp
r230303 r244694 35 35 #include "VM.h" 36 36 #include <wtf/MainThread.h> 37 #include <wtf/text/StringCommon.h> 37 38 38 39 using namespace JSC; … … 55 56 NEVER_INLINE void benchmarkImpl(const char* name, unsigned iterationCount, const Callback& callback) 56 57 { 57 if (nameFilter && !strcasestr(name, nameFilter))58 if (nameFilter && WTF::findIgnoringASCIICaseWithoutLength(name, nameFilter) == WTF::notFound) 58 59 return; 59 60 -
trunk/Source/WTF/ChangeLog
r244687 r244694 1 2019-04-26 Don Olmstead <don.olmstead@sony.com> 2 3 Add WTF::findIgnoringASCIICaseWithoutLength to replace strcasestr 4 https://bugs.webkit.org/show_bug.cgi?id=197291 5 6 Reviewed by Konstantin Tokarev. 7 8 Adds an implementation of strcasestr within WTF. 9 10 * wtf/text/StringCommon.h: 11 (WTF::findIgnoringASCIICaseWithoutLength): 12 1 13 2019-04-26 Sihui Liu <sihui_liu@apple.com> 2 14 -
trunk/Source/WTF/wtf/text/StringCommon.h
r237266 r244694 467 467 } 468 468 469 inline size_t findIgnoringASCIICaseWithoutLength(const char* source, const char* matchCharacters) 470 { 471 unsigned searchLength = strlen(source); 472 unsigned matchLength = strlen(matchCharacters); 473 474 return matchLength < searchLength ? findIgnoringASCIICase(source, matchCharacters, 0, searchLength, matchLength) : notFound; 475 } 476 469 477 template<typename StringClassA, typename StringClassB> 470 478 size_t findIgnoringASCIICase(const StringClassA& source, const StringClassB& stringToFind, unsigned startOffset)
Note: See TracChangeset
for help on using the changeset viewer.