QMetaObject: save a strlen() in typeFromTypeInfo()

QMetaType::fromName() takes a QBAV, so don't feed it rawStringData()
(a const char*, causing the QBAV ctor to run strlen() on it), but
stringDataView() (a QBAV already, whose length is determined by offset
difference in the string offset table and not by strlen()).

No measurable difference in runtime speed.

Pick-to: 6.8 6.5
Change-Id: I583bea9d818deeaac6f62803f7ac5ab4766cb8a5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1445a33b6fd4c7a401edf68e325e4527e18a667a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2025-04-08 14:44:46 +02:00 committed by Qt Cherry-pick Bot
parent 4a1de91066
commit c4b7c7b097

View File

@ -165,7 +165,7 @@ static inline int typeFromTypeInfo(const QMetaObject *mo, uint typeInfo)
{
if (!(typeInfo & IsUnresolvedType))
return typeInfo;
return QMetaType::fromName(rawStringData(mo, typeInfo & TypeNameIndexMask)).id();
return QMetaType::fromName(stringDataView(mo, typeInfo & TypeNameIndexMask)).id();
}
static auto parse_scope(QByteArrayView qualifiedKey) noexcept