Skip to content
Permalink
Browse files
Drop unnecessary overloads now that StringView(const char*) is explicit
https://bugs.webkit.org/show_bug.cgi?id=240941

Reviewed by Darin Adler.

* Source/WTF/wtf/text/AtomString.h:
* Source/WTF/wtf/text/StringImpl.h:
(WTF::StringImpl::find):
(WTF::StringImpl::reverseFind):
* Source/WTF/wtf/text/StringView.h:
* Source/WTF/wtf/text/WTFString.h:
* Source/WebCore/platform/network/HTTPHeaderMap.h:
* Source/WebCore/platform/network/ResourceRequestBase.h:
* Source/WebCore/platform/network/ResourceResponseBase.h:

Canonical link: https://commits.webkit.org/251013@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed May 26, 2022
1 parent 923a734 commit 4b4807fc479e84f2daa173498a86bc636ce8af99
Showing 7 changed files with 10 additions and 25 deletions.
@@ -98,16 +98,13 @@ class AtomString final {

bool contains(UChar character) const { return m_string.contains(character); }
bool contains(ASCIILiteral literal) const { return m_string.contains(literal); }
bool contains(const char*) const = delete;
bool contains(StringView) const;
bool containsIgnoringASCIICase(StringView) const;

size_t find(UChar character, unsigned start = 0) const { return m_string.find(character, start); }
size_t find(ASCIILiteral literal, unsigned start = 0) const { return m_string.find(literal, start); }
size_t find(const char*, unsigned start = 0) const = delete;
size_t find(StringView, unsigned start = 0) const;
size_t findIgnoringASCIICase(StringView) const;
size_t findIgnoringASCIICase(const char*) const = delete;
size_t findIgnoringASCIICase(StringView, unsigned start) const;
size_t find(CodeUnitMatchFunction matchFunction, unsigned start = 0) const { return m_string.find(matchFunction, start); }

@@ -190,7 +187,6 @@ bool equalIgnoringASCIICase(const AtomString&, const AtomString&);
bool equalIgnoringASCIICase(const AtomString&, const String&);
bool equalIgnoringASCIICase(const String&, const AtomString&);
bool equalIgnoringASCIICase(const AtomString&, ASCIILiteral);
bool equalIgnoringASCIICase(const AtomString&, const char*) = delete;

bool equalLettersIgnoringASCIICase(const AtomString&, ASCIILiteral);
bool startsWithLettersIgnoringASCIICase(const AtomString&, ASCIILiteral);
@@ -433,7 +433,6 @@ class StringImpl : private StringImplShape {
template<typename CodeUnitMatchFunction, std::enable_if_t<std::is_invocable_r_v<bool, CodeUnitMatchFunction, UChar>>* = nullptr>
size_t find(CodeUnitMatchFunction, unsigned start = 0);
ALWAYS_INLINE size_t find(ASCIILiteral literal, unsigned start = 0) { return find(literal.characters8(), literal.length(), start); }
size_t find(const char*, unsigned start = 0) = delete;
WTF_EXPORT_PRIVATE size_t find(StringView);
WTF_EXPORT_PRIVATE size_t find(StringView, unsigned start);
WTF_EXPORT_PRIVATE size_t findIgnoringASCIICase(StringView) const;
@@ -442,7 +441,6 @@ class StringImpl : private StringImplShape {
WTF_EXPORT_PRIVATE size_t reverseFind(UChar, unsigned start = MaxLength);
WTF_EXPORT_PRIVATE size_t reverseFind(StringView, unsigned start = MaxLength);
ALWAYS_INLINE size_t reverseFind(ASCIILiteral literal, unsigned start = MaxLength) { return reverseFind(literal.characters8(), literal.length(), start); }
size_t reverseFind(const char*, unsigned start = MaxLength) = delete;

WTF_EXPORT_PRIVATE bool startsWith(StringView) const;
WTF_EXPORT_PRIVATE bool startsWithIgnoringASCIICase(StringView) const;
@@ -589,8 +587,6 @@ bool equalIgnoringASCIICase(const StringImpl&, const StringImpl&);
WTF_EXPORT_PRIVATE bool equalIgnoringASCIICase(const StringImpl*, const StringImpl*);
bool equalIgnoringASCIICase(const StringImpl&, ASCIILiteral);
bool equalIgnoringASCIICase(const StringImpl*, ASCIILiteral);
bool equalIgnoringASCIICase(const StringImpl&, const char*) = delete;
bool equalIgnoringASCIICase(const StringImpl*, const char*) = delete;

WTF_EXPORT_PRIVATE bool equalIgnoringASCIICaseNonNull(const StringImpl*, const StringImpl*);

@@ -151,12 +151,10 @@ class StringView final {
template<typename CodeUnitMatchFunction, std::enable_if_t<std::is_invocable_r_v<bool, CodeUnitMatchFunction, UChar>>* = nullptr>
size_t find(CodeUnitMatchFunction&&, unsigned start = 0) const;
ALWAYS_INLINE size_t find(ASCIILiteral literal, unsigned start = 0) const { return find(literal.characters8(), literal.length(), start); }
size_t find(const char*, unsigned start = 0) const = delete;
WTF_EXPORT_PRIVATE size_t find(StringView, unsigned start = 0) const;

size_t reverseFind(UChar, unsigned index = std::numeric_limits<unsigned>::max()) const;
ALWAYS_INLINE size_t reverseFind(ASCIILiteral literal, unsigned start = std::numeric_limits<unsigned>::max()) const { return reverseFind(literal.characters8(), literal.length(), start); }
size_t reverseFind(const char*, unsigned start = std::numeric_limits<unsigned>::max()) const = delete;
WTF_EXPORT_PRIVATE size_t reverseFind(StringView, unsigned start = std::numeric_limits<unsigned>::max()) const;

WTF_EXPORT_PRIVATE size_t findIgnoringASCIICase(StringView) const;
@@ -170,7 +168,6 @@ class StringView final {
template<typename CodeUnitMatchFunction, std::enable_if_t<std::is_invocable_r_v<bool, CodeUnitMatchFunction, UChar>>* = nullptr>
bool contains(CodeUnitMatchFunction&&) const;
bool contains(ASCIILiteral literal) const { return find(literal) != notFound; }
bool contains(const char*) const = delete;
bool contains(StringView string) const { return find(string) != notFound; }

WTF_EXPORT_PRIVATE bool containsIgnoringASCIICase(StringView) const;
@@ -234,7 +231,6 @@ bool equal(StringView, StringView);
bool equal(StringView, const LChar* b);

bool equalIgnoringASCIICase(StringView, StringView);
bool equalIgnoringASCIICase(StringView, const char*) = delete;
bool equalIgnoringASCIICase(StringView, ASCIILiteral);

WTF_EXPORT_PRIVATE bool equalRespectingNullity(StringView, StringView);
@@ -354,7 +354,6 @@ template<size_t inlineCapacity> inline bool operator!=(const String& a, const Ve

bool equalIgnoringASCIICase(const String&, const String&);
bool equalIgnoringASCIICase(const String&, ASCIILiteral);
bool equalIgnoringASCIICase(const String&, const char*) = delete;

bool equalLettersIgnoringASCIICase(const String&, ASCIILiteral);
bool startsWithLettersIgnoringASCIICase(const String&, ASCIILiteral);
@@ -495,8 +494,6 @@ ALWAYS_INLINE String WARN_UNUSED_RETURN makeStringByReplacingAll(const String& s
return string;
}

String makeStringByReplacingAll(const String&, UChar target, const char*) = delete;

WTF_EXPORT_PRIVATE String WARN_UNUSED_RETURN makeStringByRemoving(const String&, unsigned position, unsigned lengthToRemove);

template<size_t inlineCapacity> inline String String::make8BitFrom16BitSource(const Vector<UChar, inlineCapacity>& buffer)
@@ -178,10 +178,10 @@ class HTTPHeaderMap {
WEBCORE_EXPORT bool remove(HTTPHeaderName);

// Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.
template<size_t length> String get(const char (&)[length]) const = delete;
template<size_t length> void set(const char (&)[length], const String&) = delete;
template<size_t length> bool contains(const char (&)[length]) = delete;
template<size_t length> bool remove(const char (&)[length]) = delete;
template<size_t length> String get(ASCIILiteral) const = delete;
template<size_t length> void set(ASCIILiteral, const String&) = delete;
template<size_t length> bool contains(ASCIILiteral) = delete;
template<size_t length> bool remove(ASCIILiteral) = delete;

const CommonHeadersVector& commonHeaders() const { return m_commonHeaders; }
const UncommonHeadersVector& uncommonHeaders() const { return m_uncommonHeaders; }
@@ -111,9 +111,9 @@ class ResourceRequestBase {
WEBCORE_EXPORT bool hasHTTPHeaderField(HTTPHeaderName) const;

// Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.
template<size_t length> String httpHeaderField(const char (&)[length]) const = delete;
template<size_t length> void setHTTPHeaderField(const char (&)[length], const String&) = delete;
template<size_t length> void addHTTPHeaderField(const char (&)[length], const String&) = delete;
template<size_t length> String httpHeaderField(ASCIILiteral) const = delete;
template<size_t length> void setHTTPHeaderField(ASCIILiteral, const String&) = delete;
template<size_t length> void addHTTPHeaderField(ASCIILiteral, const String&) = delete;

WEBCORE_EXPORT void clearHTTPAuthorization();

@@ -130,9 +130,9 @@ class ResourceResponseBase {
WEBCORE_EXPORT void addUncommonHTTPHeaderField(const String& name, const String& value);

// Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.
template<size_t length> String httpHeaderField(const char (&)[length]) const = delete;
template<size_t length> void setHTTPHeaderField(const char (&)[length], const String&) = delete;
template<size_t length> void addHTTPHeaderField(const char (&)[length], const String&) = delete;
template<size_t length> String httpHeaderField(ASCIILiteral) const = delete;
template<size_t length> void setHTTPHeaderField(ASCIILiteral, const String&) = delete;
template<size_t length> void addHTTPHeaderField(ASCIILiteral, const String&) = delete;

bool isMultipart() const { return mimeType() == "multipart/x-mixed-replace"; }

0 comments on commit 4b4807f

Please sign in to comment.