From cd3569d69adc61655d3c797f5cc764782e8bbe53 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 26 Jan 2022 14:00:20 +0100 Subject: QString: optimize compare_helper For a long time now we have fast mixed UTF-16/UTF-8 comparisons. But no-one told this ol' relic, which still converted UTF-8 to UTF-16 for comparison. Fix by using QtPrivate::compareStrings(QSV, QU8SV), which, as the central entry point, uses the fast-path. Consequently, compare_helper can now be noexcept. Pick-to: 6.3 6.2 Change-Id: I4cc9f07d9bc48628f1fe695e80015a9a07b79d6f Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/text/qstring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/text/qstring.h') diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 8eb0dd630f..80139205af 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -1106,7 +1106,7 @@ private: Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; static int compare_helper(const QChar *data1, qsizetype length1, const char *data2, qsizetype length2, - Qt::CaseSensitivity cs = Qt::CaseSensitive); + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; static int localeAwareCompare_helper(const QChar *data1, qsizetype length1, const QChar *data2, qsizetype length2); static QString toLower_helper(const QString &str); -- cgit v1.2.3