Modified: trunk/Source/WebCore/ChangeLog (256109 => 256110)
--- trunk/Source/WebCore/ChangeLog 2020-02-10 04:47:15 UTC (rev 256109)
+++ trunk/Source/WebCore/ChangeLog 2020-02-10 05:49:46 UTC (rev 256110)
@@ -1,3 +1,15 @@
+2020-02-09 Basuke Suzuki <[email protected]>
+
+ Replace redundant functions with variadic template function.
+ https://bugs.webkit.org/show_bug.cgi?id=207413
+
+ Reviewed by Darin Adler.
+
+ No new tests. Covered by existing tests.
+
+ * loader/TextResourceDecoder.cpp:
+ (WebCore::bytesEqual):
+
2020-02-09 Keith Rollin <[email protected]>
Re-enable LTO for ARM builds
Modified: trunk/Source/WebCore/loader/TextResourceDecoder.cpp (256109 => 256110)
--- trunk/Source/WebCore/loader/TextResourceDecoder.cpp 2020-02-10 04:47:15 UTC (rev 256109)
+++ trunk/Source/WebCore/loader/TextResourceDecoder.cpp 2020-02-10 05:49:46 UTC (rev 256110)
@@ -37,31 +37,17 @@
using namespace HTMLNames;
-static inline bool bytesEqual(const char* p, char b0, char b1)
+static constexpr bool bytesEqual(const char* p, char b)
{
- return p[0] == b0 && p[1] == b1;
+ return *p == b;
}
-static inline bool bytesEqual(const char* p, char b0, char b1, char b2, char b3, char b4)
+template<typename... T>
+static constexpr bool bytesEqual(const char* p, char b, T... bs)
{
- return p[0] == b0 && p[1] == b1 && p[2] == b2 && p[3] == b3 && p[4] == b4;
+ return *p == b && bytesEqual(p + 1, bs...);
}
-static inline bool bytesEqual(const char* p, char b0, char b1, char b2, char b3, char b4, char b5)
-{
- return p[0] == b0 && p[1] == b1 && p[2] == b2 && p[3] == b3 && p[4] == b4 && p[5] == b5;
-}
-
-static inline bool bytesEqual(const char* p, char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7)
-{
- return p[0] == b0 && p[1] == b1 && p[2] == b2 && p[3] == b3 && p[4] == b4 && p[5] == b5 && p[6] == b6 && p[7] == b7;
-}
-
-static inline bool bytesEqual(const char* p, char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7, char b8, char b9)
-{
- return p[0] == b0 && p[1] == b1 && p[2] == b2 && p[3] == b3 && p[4] == b4 && p[5] == b5 && p[6] == b6 && p[7] == b7 && p[8] == b8 && p[9] == b9;
-}
-
// You might think we should put these find functions elsewhere, perhaps with the
// similar functions that operate on UChar, but arguably only the decoder has
// a reason to process strings of char rather than UChar.