From 09172772016957160c300765789fe4ba05e0620a Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 25 Jun 2023 04:44:52 +0300 Subject: [PATCH] kdecore: remove unused KUrl::CompareWithoutFragment enum doubles as optimization for KUrl comparisons Signed-off-by: Ivailo Monev --- kdecore/io/kurl.cpp | 35 ++++++++++++----------------------- kdecore/io/kurl.h | 7 +------ 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/kdecore/io/kurl.cpp b/kdecore/io/kurl.cpp index d45bcab2..650307d3 100644 --- a/kdecore/io/kurl.cpp +++ b/kdecore/io/kurl.cpp @@ -432,34 +432,23 @@ bool KUrl::equals(const KUrl &u, const EqualsOptions &options) const return false; } - if (options & CompareWithoutTrailingSlash || options & CompareWithoutFragment) { - QString path1 = path((options & CompareWithoutTrailingSlash) ? RemoveTrailingSlash : LeaveTrailingSlash); - QString path2 = u.path((options & CompareWithoutTrailingSlash) ? RemoveTrailingSlash : LeaveTrailingSlash); - - if (options & AllowEmptyPath) { - if (path1 == QLatin1String("/")) { - path1.clear(); - } - if (path2 == QLatin1String("/")) { - path2.clear(); - } + QString path1 = path((options & CompareWithoutTrailingSlash) ? RemoveTrailingSlash : LeaveTrailingSlash); + QString path2 = u.path((options & CompareWithoutTrailingSlash) ? RemoveTrailingSlash : LeaveTrailingSlash); + if (options & AllowEmptyPath) { + if (path1 == QLatin1String("/")) { + path1.clear(); } - - if (path1 != path2) { - return false; - } - - if (scheme() == u.scheme() && - authority() == u.authority() && // user+pass+host+port - query() == u.query() && - (fragment() == u.fragment() || options & CompareWithoutFragment)) - { - return true; + if (path2 == QLatin1String("/")) { + path2.clear(); } + } + if (path1 != path2) { return false; } - return (*this == u); + return (scheme() == u.scheme() && + authority() == u.authority() && // user+pass+host+port + query() == u.query() && fragment() == u.fragment()); } KUrl KUrl::fromPath(const QString &text) diff --git a/kdecore/io/kurl.h b/kdecore/io/kurl.h index 032abaf0..7efe4311 100644 --- a/kdecore/io/kurl.h +++ b/kdecore/io/kurl.h @@ -587,11 +587,6 @@ public: */ CompareWithoutTrailingSlash = 0x01, - /** - * disables comparison of HTML-style references. - */ - CompareWithoutFragment = 0x02, - /** * Treat a URL with no path as equal to a URL with a path of "/", * when CompareWithoutTrailingSlash is set. @@ -601,7 +596,7 @@ public: * This option is ignored if CompareWithoutTrailingSlash isn't set. * @since 4.5 */ - AllowEmptyPath = 0x04 + AllowEmptyPath = 0x02 }; Q_DECLARE_FLAGS(EqualsOptions, EqualsOption)