summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-13 10:27:14 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-13 10:27:14 (GMT)
commit474a2b1dd807c3590360dad2d7157fbee9f9af6b (patch)
treebaf8d22f80f0d3d61d70071a5a8d81e5837187c7
parent6d544f0c9091e92f47a765bf3de4ebf436d69215 (diff)
Minor optimization
-rw-r--r--src/agentbase/agentsearchinterface.cpp3
-rw-r--r--src/agentbase/resourcescheduler.cpp3
-rw-r--r--src/core/jobs/collectionmodifyjob.cpp5
3 files changed, 7 insertions, 4 deletions
diff --git a/src/agentbase/agentsearchinterface.cpp b/src/agentbase/agentsearchinterface.cpp
index 9e30d35..f73b7e6 100644
--- a/src/agentbase/agentsearchinterface.cpp
+++ b/src/agentbase/agentsearchinterface.cpp
@@ -127,7 +127,8 @@ void AgentSearchInterface::searchFinished(const ImapSet &result, ResultScope sco
if (scope == Akonadi::AgentSearchInterface::Rid) {
QVector<QByteArray> rids;
Q_FOREACH (const ImapInterval &interval, result.intervals()) {
- for (int i = interval.begin(); i <= interval.end(); ++i) {
+ const int endInterval(interval.end());
+ for (int i = interval.begin(); i <= endInterval; ++i) {
rids << QByteArray::number(i);
}
}
diff --git a/src/agentbase/resourcescheduler.cpp b/src/agentbase/resourcescheduler.cpp
index cad6fc3..0a54596 100644
--- a/src/agentbase/resourcescheduler.cpp
+++ b/src/agentbase/resourcescheduler.cpp
@@ -624,7 +624,8 @@ QString ResourceScheduler::dumpToString() const
str << " queue " << i << " is empty" << endl;
} else {
str << " queue " << i << " " << queue.size() << " tasks:" << endl;
- for (QList<Task>::const_iterator it = queue.begin(); it != queue.end(); ++it) {
+ QList<Task>::const_iterator queueEnd(queue.constEnd());
+ for (QList<Task>::const_iterator it = queue.constBegin(); it != queueEnd; ++it) {
str << " " << (*it) << endl;
}
}
diff --git a/src/core/jobs/collectionmodifyjob.cpp b/src/core/jobs/collectionmodifyjob.cpp
index a798371..7923d6a 100644
--- a/src/core/jobs/collectionmodifyjob.cpp
+++ b/src/core/jobs/collectionmodifyjob.cpp
@@ -75,8 +75,9 @@ void CollectionModifyJob::doStart()
if (d->mCollection.parentCollection().id() >= 0) {
cmd.setParentId(d->mCollection.parentCollection().id());
}
- if (!d->mCollection.name().isEmpty()) {
- cmd.setName(d->mCollection.name());
+ const QString &collectionName = d->mCollection.name();
+ if (!collectionName.isEmpty()) {
+ cmd.setName(collectionName);
}
if (!d->mCollection.remoteId().isNull()) {
cmd.setRemoteId(d->mCollection.remoteId());