summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2015-12-24 16:38:21 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-01-12 05:16:48 +0000
commitf59b12c6293505af64d86afa87a1535a603f0b01 (patch)
tree18bf9e84b364898fd965f01304ea643112bf62f1 /qmake
parent5034d4163048c74668ab0f33e963b9eab3d206a0 (diff)
MakefileGenerator: use erase and std::remove_if with QVector
... instead of using erase in a loop, with quadratic complexity. Change-Id: I4ac03ac0e893fc5dbb5e45131fcbfe82f1564bee Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/makefile.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index a54083c04d..8616e80081 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -59,6 +59,8 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
using namespace QMakeInternal;
@@ -939,12 +941,12 @@ void
MakefileGenerator::filterIncludedFiles(const char *var)
{
ProStringList &inputs = project->values(var);
- for (ProStringList::Iterator input = inputs.begin(); input != inputs.end(); ) {
- if (QMakeSourceFileInfo::included((*input).toQString()) > 0)
- input = inputs.erase(input);
- else
- ++input;
- }
+ auto isIncluded = [this](const ProString &input) {
+ return QMakeSourceFileInfo::included(input.toQString()) > 0;
+ };
+ inputs.erase(std::remove_if(inputs.begin(), inputs.end(),
+ isIncluded),
+ inputs.end());
}
static QString