summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-01-28 16:09:46 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-02-01 14:12:19 +0000
commit5af12dae41da231c9e8fa25478605a760ccb03bd (patch)
tree0dbfa67c7d13d13e7eeb0c26793dc541c66ac8b5 /qmake/generators
parent14efcaa3921687129d4dca9b7d5794668a329cd6 (diff)
qmake: replace a QLinkedList with QVector
In VcprojGenerator::collectDependencies(), a temporary QLinkedList is created, then iterated over. There's no reason to use a node- based container here: no references are taken, no erases happen, esp. not in the middle... Port to QVector instead and reserve it, since the maximum size is known ahead of time, and the lifetime of the container is very short. Since the loop iterating over the linked list needed touching anyway, port directly to C++11 range-for. Change-Id: Ic5dfeebcd9da37c214f54abc6025a0a2b8fa3b5d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index cb0b1b1331..d473f3df9f 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -434,10 +434,12 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
QHash<QString, ProStringList> &subdirProjectLookup,
const ProStringList &allDependencies)
{
- QLinkedList<QPair<QString, ProStringList> > collectedSubdirs;
+ QVector<QPair<QString, ProStringList> > collectedSubdirs;
ProStringList tmp_proj_subdirs = proj->values("SUBDIRS");
ProStringList projectsInProject;
- for(int x = 0; x < tmp_proj_subdirs.size(); ++x) {
+ const int numSubdirs = tmp_proj_subdirs.size();
+ collectedSubdirs.reserve(numSubdirs);
+ for (int x = 0; x < numSubdirs; ++x) {
ProString tmpdir = tmp_proj_subdirs.at(x);
const ProKey tmpdirConfig(tmpdir + ".CONFIG");
if (!proj->isEmpty(tmpdirConfig)) {
@@ -459,9 +461,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
collectedSubdirs.append(qMakePair(tmpdir.toQString(), proj->values(ProKey(tmp_proj_subdirs.at(x) + ".depends"))));
projLookup.insert(tmp_proj_subdirs.at(x).toQString(), tmpdir.toQString());
}
- QLinkedListIterator<QPair<QString, ProStringList> > collectedIt(collectedSubdirs);
- while (collectedIt.hasNext()) {
- QPair<QString, ProStringList> subdir = collectedIt.next();
+ for (const auto &subdir : qAsConst(collectedSubdirs)) {
QString profile = subdir.first;
QFileInfo fi(fileInfo(Option::normalizePath(profile)));
if (fi.exists()) {