summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-08-05 20:21:11 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-08-06 14:19:52 +0200
commitccec95fda6bedb67139e2049320e929a9acd8f2a (patch)
tree8f725bbe17aa29ea3f66fb321a0cd9d3feed34a8
parent87973325f1b99f2b25a5a0224e623803872ce2ef (diff)
QCoreGlobalData: use QHash, not QMap, for dirSearchPaths
No user of the variable iterates over the container, they only manipulate or inspect individual entries, so order doesn't matter. If order doesn't matter, use the more efficient QHash over QMap. Change-Id: Id28913a57bb14eb328e668624f236f76cad86def Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/io/qdir.cpp2
-rw-r--r--src/corelib/kernel/qcoreglobaldata_p.h3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 76336ef384..639693346d 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1099,7 +1099,7 @@ void QDir::setSearchPaths(const QString &prefix, const QStringList &searchPaths)
}
QWriteLocker lock(&QCoreGlobalData::instance()->dirSearchPathsLock);
- QMap<QString, QStringList> &paths = QCoreGlobalData::instance()->dirSearchPaths;
+ QHash<QString, QStringList> &paths = QCoreGlobalData::instance()->dirSearchPaths;
if (searchPaths.isEmpty()) {
paths.remove(prefix);
} else {
diff --git a/src/corelib/kernel/qcoreglobaldata_p.h b/src/corelib/kernel/qcoreglobaldata_p.h
index 35b576f546..4403c2ebdd 100644
--- a/src/corelib/kernel/qcoreglobaldata_p.h
+++ b/src/corelib/kernel/qcoreglobaldata_p.h
@@ -52,7 +52,6 @@
//
#include <QtCore/private/qglobal_p.h>
-#include "QtCore/qmap.h"
#include "QtCore/qstringlist.h"
#include "QtCore/qreadwritelock.h"
#include "QtCore/qhash.h"
@@ -66,7 +65,7 @@ struct QCoreGlobalData
QCoreGlobalData();
~QCoreGlobalData();
- QMap<QString, QStringList> dirSearchPaths;
+ QHash<QString, QStringList> dirSearchPaths;
QReadWriteLock dirSearchPathsLock;
static QCoreGlobalData *instance();