diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-25 12:23:56 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-29 07:57:51 +0000 |
commit | be84480785b9686dc09937fa33b685de7cc570f1 (patch) | |
tree | ecfce6d5214095cc82d3c96df38cd07b4b7add18 /src/testlib/qbenchmarkvalgrind.cpp | |
parent | a7885c9756d423042bd0670d82d78d8dffe9be54 (diff) | |
download | qtbase-be84480785b9686dc09937fa33b685de7cc570f1.tar.gz |
QtTest: eradicate all Q_FOREACH loops
... by replacing them with C++11 ramge-for loops.
In one case, I took the liberty to remove a useless
if(isEmpty()) check around a for loop. Now that we
don't use Q_FOREACH anymore, we don't incur the copy
for empty containers anymore. Left the indention of
the loop level to avoid code churn.
Saves 1.8KiB in text size on optimized GCC 5.3 Linux
AMD64 builds.
Change-Id: I1b1fb34847f6a631f0d580fd5261c7f5fed8475c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/testlib/qbenchmarkvalgrind.cpp')
-rw-r--r-- | src/testlib/qbenchmarkvalgrind.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp index af500722c6..1de149258d 100644 --- a/src/testlib/qbenchmarkvalgrind.cpp +++ b/src/testlib/qbenchmarkvalgrind.cpp @@ -115,13 +115,13 @@ QString QBenchmarkValgrindUtils::getNewestFileName() Q_ASSERT(!base.isEmpty()); nameFilters << QString::fromLatin1("%1.*").arg(base); - QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable); + const QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable); Q_ASSERT(!fiList.empty()); int hiSuffix = -1; QFileInfo lastFileInfo; const QString pattern = QString::fromLatin1("%1.(\\d+)").arg(base); QRegExp rx(pattern); - foreach (const QFileInfo &fileInfo, fiList) { + for (const QFileInfo &fileInfo : fiList) { const int index = rx.indexIn(fileInfo.fileName()); Q_ASSERT(index == 0); Q_UNUSED(index); @@ -151,8 +151,8 @@ void QBenchmarkValgrindUtils::cleanup() nameFilters << base // overall summary << QString::fromLatin1("%1.*").arg(base); // individual dumps - QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable); - foreach (const QFileInfo &fileInfo, fiList) { + const QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable); + for (const QFileInfo &fileInfo : fiList) { const bool removeOk = QFile::remove(fileInfo.fileName()); Q_ASSERT(removeOk); Q_UNUSED(removeOk); |