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>
bb10
Marc Mutz 2021-08-05 20:21:11 +02:00
parent 87973325f1
commit ccec95fda6
2 changed files with 2 additions and 3 deletions

View File

@ -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 {

View File

@ -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();