Title: [163398] trunk/Source
Revision
163398
Author
[email protected]
Date
2014-02-04 13:32:54 -0800 (Tue, 04 Feb 2014)

Log Message

Rename equalNonNull to equal and make it take const StringImpl& instead
https://bugs.webkit.org/show_bug.cgi?id=128206

Reviewed by Andreas Kling.

Source/WebCore:

* html/parser/HTMLParserIdioms.cpp:
(WebCore::threadSafeEqual):
(WebCore::threadSafeMatch):

Source/WTF:

* wtf/text/StringHash.h:
(WTF::StringHash::equal):
* wtf/text/StringImpl.cpp:
(WTF::stringImplContentEqual):
(WTF::equal):
* wtf/text/StringImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (163397 => 163398)


--- trunk/Source/WTF/ChangeLog	2014-02-04 21:27:19 UTC (rev 163397)
+++ trunk/Source/WTF/ChangeLog	2014-02-04 21:32:54 UTC (rev 163398)
@@ -1,5 +1,19 @@
 2014-02-04  Anders Carlsson  <[email protected]>
 
+        Rename equalNonNull to equal and make it take const StringImpl& instead
+        https://bugs.webkit.org/show_bug.cgi?id=128206
+
+        Reviewed by Andreas Kling.
+
+        * wtf/text/StringHash.h:
+        (WTF::StringHash::equal):
+        * wtf/text/StringImpl.cpp:
+        (WTF::stringImplContentEqual):
+        (WTF::equal):
+        * wtf/text/StringImpl.h:
+
+2014-02-04  Anders Carlsson  <[email protected]>
+
         Get rid of StringImpl::m_buffer
         https://bugs.webkit.org/show_bug.cgi?id=128200
 

Modified: trunk/Source/WTF/wtf/text/StringHash.h (163397 => 163398)


--- trunk/Source/WTF/wtf/text/StringHash.h	2014-02-04 21:27:19 UTC (rev 163397)
+++ trunk/Source/WTF/wtf/text/StringHash.h	2014-02-04 21:32:54 UTC (rev 163398)
@@ -45,7 +45,7 @@
         static unsigned hash(StringImpl* key) { return key->hash(); }
         static inline bool equal(const StringImpl* a, const StringImpl* b)
         {
-            return equalNonNull(a, b);
+            return WTF::equal(*a, *b);
         }
 
         static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }

Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (163397 => 163398)


--- trunk/Source/WTF/wtf/text/StringImpl.cpp	2014-02-04 21:27:19 UTC (rev 163397)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp	2014-02-04 21:32:54 UTC (rev 163398)
@@ -1769,24 +1769,24 @@
     return newImpl;
 }
 
-static inline bool stringImplContentEqual(const StringImpl* a, const StringImpl* b)
+static inline bool stringImplContentEqual(const StringImpl& a, const StringImpl& b)
 {
-    unsigned aLength = a->length();
-    unsigned bLength = b->length();
+    unsigned aLength = a.length();
+    unsigned bLength = b.length();
     if (aLength != bLength)
         return false;
 
-    if (a->is8Bit()) {
-        if (b->is8Bit())
-            return equal(a->characters8(), b->characters8(), aLength);
+    if (a.is8Bit()) {
+        if (b.is8Bit())
+            return equal(a.characters8(), b.characters8(), aLength);
 
-        return equal(a->characters8(), b->characters16(), aLength);
+        return equal(a.characters8(), b.characters16(), aLength);
     }
 
-    if (b->is8Bit())
-        return equal(a->characters16(), b->characters8(), aLength);
+    if (b.is8Bit())
+        return equal(a.characters16(), b.characters8(), aLength);
 
-    return equal(a->characters16(), b->characters16(), aLength);
+    return equal(a.characters16(), b.characters16(), aLength);
 }
 
 bool equal(const StringImpl* a, const StringImpl* b)
@@ -1796,7 +1796,7 @@
     if (!a || !b)
         return false;
 
-    return stringImplContentEqual(a, b);
+    return stringImplContentEqual(*a, *b);
 }
 
 template <typename CharType>
@@ -1859,10 +1859,9 @@
     return !b[length];
 }
 
-bool equalNonNull(const StringImpl* a, const StringImpl* b)
+bool equal(const StringImpl& a, const StringImpl& b)
 {
-    ASSERT(a && b);
-    if (a == b)
+    if (&a == &b)
         return true;
 
     return stringImplContentEqual(a, b);

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (163397 => 163398)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2014-02-04 21:27:19 UTC (rev 163397)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2014-02-04 21:32:54 UTC (rev 163398)
@@ -894,7 +894,7 @@
 inline bool equal(const StringImpl* a, const char* b, unsigned length) { return equal(a, reinterpret_cast<const LChar*>(b), length); }
 inline bool equal(const LChar* a, StringImpl* b) { return equal(b, a); }
 inline bool equal(const char* a, StringImpl* b) { return equal(b, reinterpret_cast<const LChar*>(a)); }
-WTF_EXPORT_STRING_API bool equalNonNull(const StringImpl* a, const StringImpl* b);
+WTF_EXPORT_STRING_API bool equal(const StringImpl& a, const StringImpl& b);
 
 // Do comparisons 8 or 4 bytes-at-a-time on architectures where it's safe.
 #if CPU(X86_64) || CPU(ARM64)
@@ -1379,7 +1379,6 @@
 
 using WTF::StringImpl;
 using WTF::equal;
-using WTF::equalNonNull;
 using WTF::TextCaseSensitivity;
 using WTF::TextCaseSensitive;
 using WTF::TextCaseInsensitive;

Modified: trunk/Source/WebCore/ChangeLog (163397 => 163398)


--- trunk/Source/WebCore/ChangeLog	2014-02-04 21:27:19 UTC (rev 163397)
+++ trunk/Source/WebCore/ChangeLog	2014-02-04 21:32:54 UTC (rev 163398)
@@ -1,5 +1,16 @@
 2014-02-04  Anders Carlsson  <[email protected]>
 
+        Rename equalNonNull to equal and make it take const StringImpl& instead
+        https://bugs.webkit.org/show_bug.cgi?id=128206
+
+        Reviewed by Andreas Kling.
+
+        * html/parser/HTMLParserIdioms.cpp:
+        (WebCore::threadSafeEqual):
+        (WebCore::threadSafeMatch):
+
+2014-02-04  Anders Carlsson  <[email protected]>
+
         Rename String::getCharacters to String::characters
         https://bugs.webkit.org/show_bug.cgi?id=128196
 

Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (163397 => 163398)


--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp	2014-02-04 21:27:19 UTC (rev 163397)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp	2014-02-04 21:32:54 UTC (rev 163398)
@@ -276,18 +276,18 @@
     return parseHTMLNonNegativeIntegerInternal(start, start + length, value);
 }
 
-static bool threadSafeEqual(const StringImpl* a, const StringImpl* b)
+static bool threadSafeEqual(const StringImpl& a, const StringImpl& b)
 {
-    if (a == b)
+    if (&a == &b)
         return true;
-    if (a->hash() != b->hash())
+    if (a.hash() != b.hash())
         return false;
-    return equalNonNull(a, b);
+    return equal(a, b);
 }
 
 bool threadSafeMatch(const QualifiedName& a, const QualifiedName& b)
 {
-    return threadSafeEqual(a.localName().impl(), b.localName().impl());
+    return threadSafeEqual(*a.localName().impl(), *b.localName().impl());
 }
 
 struct ImageWithScale {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to