From 2e23954271a57324a57cceb61da91675eeae9643 Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Tue, 1 Jun 2021 11:14:30 +0200 Subject: [PATCH] AK: Move identity check from URL::operator==() to equals() --- AK/URL.cpp | 2 ++ AK/URL.h | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/AK/URL.cpp b/AK/URL.cpp index 5e3ad55f9f..c613e4f12e 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -327,6 +327,8 @@ String URL::serialize_for_display() const bool URL::equals(URL const& other, ExcludeFragment exclude_fragments) const { + if (this == &other) + return true; if (!m_valid || !other.m_valid) return false; return serialize(exclude_fragments) == other.serialize(exclude_fragments); diff --git a/AK/URL.h b/AK/URL.h index f229b0d188..f4c1d9e351 100644 --- a/AK/URL.h +++ b/AK/URL.h @@ -101,12 +101,7 @@ public: static String percent_encode(StringView const& input, PercentEncodeSet set = PercentEncodeSet::Userinfo); static String percent_decode(StringView const& input); - bool operator==(URL const& other) const - { - if (this == &other) - return true; - return equals(other, ExcludeFragment::No); - } + bool operator==(URL const& other) const { return equals(other, ExcludeFragment::No); } private: URL(String&& data_mime_type, String&& data_payload, bool payload_is_base64)