WebKit Bugzilla
Attachment 357580 Details for
Bug 192813
: Use idiomatic const references for equality helper methods for WTF::StringView class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v1
bug-192813-20181218105346.patch (text/plain), 5.26 KB, created by
David Kilzer (:ddkilzer)
on 2018-12-18 10:53:47 PST
(
hide
)
Description:
Patch v1
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2018-12-18 10:53:47 PST
Size:
5.26 KB
patch
obsolete
>Subversion Revision: 239276 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 9c480a59618c220101a77c9bf62f917ce69c6f4a..72e0a93b7aa2fa2b66b0f80d058edee07c32cd20 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-17 David Kilzer <ddkilzer@apple.com> >+ >+ Use idiomatic const references for equality methods in WTF::StringView class >+ <https://webkit.org/b/192813> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/text/StringView.h: >+ (WTF::operator==): >+ (WTF::operator!=): >+ (WTF::equal): >+ (WTF::equalIgnoringASCIICase): >+ (WTF::equalLettersIgnoringASCIICase): >+ - Switch to use idiomatic const references for equality methods. >+ > 2018-12-17 Daniel Bates <dabates@apple.com> > > Fix the Apple Internal Mac build with a newer SDK >diff --git a/Source/WTF/wtf/text/StringView.h b/Source/WTF/wtf/text/StringView.h >index 7314e56d94108fba95200a7830e76b7604f7ad22..a83fe4dde8119058a4479fd0a95819188901c36b 100644 >--- a/Source/WTF/wtf/text/StringView.h >+++ b/Source/WTF/wtf/text/StringView.h >@@ -161,7 +161,7 @@ public: > struct UnderlyingString; > > private: >- friend bool equal(StringView, StringView); >+ friend bool equal(const StringView&, const StringView&); > > void initialize(const LChar*, unsigned length); > void initialize(const UChar*, unsigned length); >@@ -192,24 +192,24 @@ private: > > template<typename CharacterType, size_t inlineCapacity> void append(Vector<CharacterType, inlineCapacity>&, StringView); > >-bool equal(StringView, StringView); >-bool equal(StringView, const LChar* b); >+bool equal(const StringView&, const StringView&); >+bool equal(const StringView&, const LChar* b); > >-bool equalIgnoringASCIICase(StringView, StringView); >-bool equalIgnoringASCIICase(StringView, const char*); >+bool equalIgnoringASCIICase(const StringView&, const StringView&); >+bool equalIgnoringASCIICase(const StringView&, const char*); > >-template<unsigned length> bool equalLettersIgnoringASCIICase(StringView, const char (&lowercaseLetters)[length]); >+template<unsigned length> bool equalLettersIgnoringASCIICase(const StringView&, const char (&lowercaseLetters)[length]); > >-inline bool operator==(StringView a, StringView b) { return equal(a, b); } >-inline bool operator==(StringView a, const LChar *b); >-inline bool operator==(StringView a, const char *b) { return equal(a, reinterpret_cast<const LChar*>(b)); } >-inline bool operator==(const char* a, StringView b) { return equal(b, a); } >+inline bool operator==(const StringView& a, const StringView& b) { return equal(a, b); } >+inline bool operator==(const StringView& a, const LChar* b); >+inline bool operator==(const StringView& a, const char* b) { return equal(a, reinterpret_cast<const LChar*>(b)); } >+inline bool operator==(const char* a, const StringView& b) { return equal(b, a); } > >-inline bool operator!=(StringView a, StringView b) { return !equal(a, b); } >-inline bool operator!=(StringView a, const LChar* b) { return !equal(a, b); } >-inline bool operator!=(StringView a, const char* b) { return !equal(a, b); } >-inline bool operator!=(const LChar*a, StringView b) { return !equal(b, a); } >-inline bool operator!=(const char*a, StringView b) { return !equal(b, a); } >+inline bool operator!=(const StringView& a, const StringView& b) { return !equal(a, b); } >+inline bool operator!=(const StringView& a, const LChar* b) { return !equal(a, b); } >+inline bool operator!=(const StringView& a, const char* b) { return !equal(a, b); } >+inline bool operator!=(const LChar* a, const StringView& b) { return !equal(b, a); } >+inline bool operator!=(const char* a, const StringView& b) { return !equal(b, a); } > > } > >@@ -597,7 +597,7 @@ template<typename CharacterType, size_t inlineCapacity> void append(Vector<Chara > string.getCharactersWithUpconvert(buffer.data() + oldSize); > } > >-inline bool equal(StringView a, StringView b) >+inline bool equal(const StringView& a, const StringView& b) > { > if (a.m_characters == b.m_characters) { > ASSERT(a.is8Bit() == b.is8Bit()); >@@ -607,7 +607,7 @@ inline bool equal(StringView a, StringView b) > return equalCommon(a, b); > } > >-inline bool equal(StringView a, const LChar* b) >+inline bool equal(const StringView& a, const LChar* b) > { > if (!b) > return !a.isEmpty(); >@@ -623,12 +623,12 @@ inline bool equal(StringView a, const LChar* b) > return equal(a.characters16(), b, aLength); > } > >-inline bool equalIgnoringASCIICase(StringView a, StringView b) >+inline bool equalIgnoringASCIICase(const StringView& a, const StringView& b) > { > return equalIgnoringASCIICaseCommon(a, b); > } > >-inline bool equalIgnoringASCIICase(StringView a, const char* b) >+inline bool equalIgnoringASCIICase(const StringView& a, const char* b) > { > return equalIgnoringASCIICaseCommon(a, b); > } >@@ -989,7 +989,7 @@ StringView StringView::stripLeadingAndTrailingMatchedCharacters(const MatchedCha > return stripLeadingAndTrailingMatchedCharacters<UChar>(characters16(), predicate); > } > >-template<unsigned length> inline bool equalLettersIgnoringASCIICase(StringView string, const char (&lowercaseLetters)[length]) >+template<unsigned length> inline bool equalLettersIgnoringASCIICase(const StringView& string, const char (&lowercaseLetters)[length]) > { > return equalLettersIgnoringASCIICaseCommon(string, lowercaseLetters); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192813
: 357580