Pass trivially-copyable types by value, not by const ref

The LikelyPair and QLocaleId types are small enough to pass by value.

Pick-to: 6.7 6.5
Task-number: QTBUG-122619
Change-Id: I1502efcf69ac82d9c49b673975502882c59a4fd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Edward Welbourne 2024-04-05 16:50:47 +02:00
parent e1da249be6
commit 738914e787
1 changed files with 2 additions and 2 deletions

View File

@ -252,7 +252,7 @@ struct LikelyPair
QLocaleId value = QLocaleId { 0, 0, 0 };
};
bool operator<(const LikelyPair &lhs, const LikelyPair &rhs)
bool operator<(LikelyPair lhs, LikelyPair rhs)
{
// Must match the comparison LocaleDataWriter.likelySubtags() uses when
// sorting, see qtbase/util/locale_database.qlocalexml2cpp.py
@ -465,7 +465,7 @@ QByteArray QLocalePrivate::bcp47Name(char separator) const
return m_data->id().withLikelySubtagsRemoved().name(separator);
}
static qsizetype findLocaleIndexById(const QLocaleId &localeId)
static qsizetype findLocaleIndexById(QLocaleId localeId)
{
qsizetype idx = locale_index[localeId.language_id];
// If there are no locales for specified language (so we we've got the