From ccec95fda6bedb67139e2049320e929a9acd8f2a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 5 Aug 2021 20:21:11 +0200 Subject: [PATCH] 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 --- src/corelib/io/qdir.cpp | 2 +- src/corelib/kernel/qcoreglobaldata_p.h | 3 +-- 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 &paths = QCoreGlobalData::instance()->dirSearchPaths; + QHash &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 -#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 dirSearchPaths; + QHash dirSearchPaths; QReadWriteLock dirSearchPathsLock; static QCoreGlobalData *instance();