From 17cfe9b2cfac971922bbd49cabb2fa6d2ee2c99e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 23 Apr 2024 17:34:01 -0700 Subject: [PATCH] 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 Reviewed-by: Ahmad Samir (cherry picked from commit fe6dda9bb9310878b408b2421f60acb7135bd8ba) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/io/qresource.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 7360595eaf3..d5b23722f74 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -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 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