QResource: move the internal classes to unnamed namespaces

So the compiler has more opportunities to inline and to not emit out-of-
line copies.

Change-Id: I6979d02a7395405cbf23fffd17c9101b2b52472a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit fe6dda9bb9310878b408b2421f60acb7135bd8ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2024-04-23 17:34:01 -07:00 committed by Qt Cherry-pick Bot
parent 06bb5f19bf
commit 17cfe9b2cf

View File

@ -65,6 +65,7 @@ RCC_FEATURE_SYMBOL(Zstd)
#undef RCC_FEATURE_SYMBOL
namespace {
class QStringSplitter
{
public:
@ -159,15 +160,18 @@ static QString cleanPath(const QString &_path)
path.remove(0, 1);
return path;
}
} // unnamed namespace
Q_DECLARE_TYPEINFO(QResourceRoot, Q_RELOCATABLE_TYPE);
typedef QList<QResourceRoot*> ResourceList;
namespace {
struct QResourceGlobalData
{
QRecursiveMutex resourceMutex;
ResourceList resourceList;
};
}
Q_GLOBAL_STATIC(QResourceGlobalData, resourceGlobalData)
static inline QRecursiveMutex &resourceMutex()
@ -1031,8 +1035,8 @@ Q_CORE_EXPORT bool qUnregisterResourceData(int version, const unsigned char *tre
return false;
}
namespace {
// run time resource creation
class QDynamicBufferResourceRoot : public QResourceRoot
{
QString root;
@ -1131,6 +1135,7 @@ public:
bool registerSelf(const QString &f);
};
} // unnamed namespace
#ifndef MAP_FILE
# define MAP_FILE 0