summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-03-20 19:39:48 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-03-21 09:12:57 +0100
commit52e0a91fbc187ca09d3ea6279e8bdce982edc586 (patch)
tree0cb2e17efb8292c12994d39dd0bc237d06d802bc /src/corelib/text
parent58437836f078e4a59184be2fdcda26fa546182bb (diff)
QUtf8StringView: Check size directly in operator==
We can avoid the non-inlined function call if the sizes do not match up. This aligns the implementation of QUtf8StringView's operator== with the one used for the other string classes. Change-Id: Iaaf71b236edc0385551639961f753f11b324b327 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text')
-rw-r--r--src/corelib/text/qutf8stringview.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/text/qutf8stringview.h b/src/corelib/text/qutf8stringview.h
index 8e0656660d..5069bf7b07 100644
--- a/src/corelib/text/qutf8stringview.h
+++ b/src/corelib/text/qutf8stringview.h
@@ -322,7 +322,8 @@ private:
[[nodiscard]] friend inline bool operator==(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept
{
- return QtPrivate::equalStrings(QBasicUtf8StringView<false>(lhs.data(), lhs.size()),
+ return lhs.size() == rhs.size() &&
+ QtPrivate::equalStrings(QBasicUtf8StringView<false>(lhs.data(), lhs.size()),
QBasicUtf8StringView<false>(rhs.data(), rhs.size()));
}
[[nodiscard]] friend inline bool operator!=(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept