[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [baloo] /: CLazy fixes: use const ref in for loop instead object
From:       Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date:       2016-10-15 11:16:36
Message-ID: E1bvMxA-0008Cz-RO () code ! kde ! org
[Download RAW message or body]

Git commit e6bd357153a790ef66dc803cd3451270e9311134 by Christian Ehrlicher.
Committed on 15/10/2016 at 11:15.
Pushed by chehrlic into branch 'master'.

CLazy fixes: use const ref in for loop instead object
REVIEW: 129182

M  +2    -4    src/engine/transaction.cpp
M  +1    -1    src/file/fileindexerconfig.cpp
M  +0    -1    src/file/pendingfilequeue.cpp
M  +1    -1    tests/file/storagedevicestest.cpp

http://commits.kde.org/baloo/e6bd357153a790ef66dc803cd3451270e9311134

diff --git a/src/engine/transaction.cpp b/src/engine/transaction.cpp
index 908a81f..a1e4fe3 100644
--- a/src/engine/transaction.cpp
+++ b/src/engine/transaction.cpp
@@ -454,9 +454,8 @@ void Transaction::checkFsTree()
 
     auto map = postingDb.toTestMap();
 
-    QList<PostingList> allLists = map.values();
     QSet<quint64> allIds;
-    for (auto list : allLists) {
+    Q_FOREACH (const auto& list, map) {
         for (quint64 id : list) {
             allIds << id;
         }
@@ -527,9 +526,8 @@ void Transaction::checkTermsDbinPostingDb()
 
     auto map = postingDb.toTestMap();
 
-    QList<PostingList> allLists = map.values();
     QSet<quint64> allIds;
-    for (auto list : allLists) {
+    Q_FOREACH (const auto& list, map) {
         for (quint64 id : list) {
             allIds << id;
         }
diff --git a/src/file/fileindexerconfig.cpp b/src/file/fileindexerconfig.cpp
index ccb5d80..0e4f4c4 100644
--- a/src/file/fileindexerconfig.cpp
+++ b/src/file/fileindexerconfig.cpp
@@ -286,7 +286,7 @@ void FileIndexerConfig::buildFolderCache()
 
     // Add all removable media and network shares as ignored unless they have
     // been explicitly added in the include list
-    for (auto device: m_devices->allMedia()) {
+    for (const auto& device: m_devices->allMedia()) {
         const QString mountPath = device.mountPath();
         if (!device.isUsable() && !mountPath.isEmpty()) {
             if (!includeFoldersPlain.contains(mountPath)) {
diff --git a/src/file/pendingfilequeue.cpp b/src/file/pendingfilequeue.cpp
index 489f100..685bf9e 100644
--- a/src/file/pendingfilequeue.cpp
+++ b/src/file/pendingfilequeue.cpp
@@ -57,7 +57,6 @@ void PendingFileQueue::enqueue(const PendingFile& file)
 {
     // If we get an event to remove /home/A, remove all events for everything under /home/A/
     if (file.shouldRemoveIndex() && file.path().endsWith('/')) {
-        const QString path = file.path();
         QMutableVectorIterator<PendingFile> it(m_cache);
         while (it.hasNext()) {
             PendingFile pf = it.next();
diff --git a/tests/file/storagedevicestest.cpp b/tests/file/storagedevicestest.cpp
index f269c81..d8b6241 100644
--- a/tests/file/storagedevicestest.cpp
+++ b/tests/file/storagedevicestest.cpp
@@ -32,7 +32,7 @@ int main(int argc, char** argv)
     QCoreApplication app(argc, argv);
 
     StorageDevices sd;
-    for (auto device : sd.allMedia()) {
+    for (const auto& device : sd.allMedia()) {
         qDebug() << device.mountPath() << device.isUsable();
     }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic