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.9 6.8 6.5
Change-Id: I583bea9d818deeaac6f62803f7ac5ab4766cb8a5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2025-04-08 14:44:46 +02:00
parent 5d2164382c
commit 1445a33b6f

View File

@ -165,7 +165,7 @@ static inline int typeFromTypeInfo(const QMetaObject *mo, uint typeInfo)
{ {
if (!(typeInfo & IsUnresolvedType)) if (!(typeInfo & IsUnresolvedType))
return typeInfo; 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 static auto parse_scope(QByteArrayView qualifiedKey) noexcept