aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-13 10:45:51 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-13 10:45:51 (GMT)
commit3a9f83f5933041c23a644d1ac9e9d27d492bbcd5 (patch)
tree5c8fa859787bfe416dcb2ea0228cd28c287a4e0c
parent474a2b1dd807c3590360dad2d7157fbee9f9af6b (diff)
Reserve some size
-rw-r--r--src/core/persistentsearchattribute.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/persistentsearchattribute.cpp b/src/core/persistentsearchattribute.cpp
index 26f86a5..6959898 100644
--- a/src/core/persistentsearchattribute.cpp
+++ b/src/core/persistentsearchattribute.cpp
@@ -70,6 +70,7 @@ QList<qint64> PersistentSearchAttribute::queryCollections() const
void PersistentSearchAttribute::setQueryCollections(const QVector<Collection> &collections)
{
d->queryCollections.clear();
+ d->queryCollections.reserve(collections.count());
Q_FOREACH (const Collection &collection, collections) {
d->queryCollections << collection.id();
}
@@ -143,7 +144,8 @@ void PersistentSearchAttribute::deserialize(const QByteArray &data)
{
QList<QByteArray> l;
ImapParser::parseParenthesizedList(data, l);
- for (int i = 0; i < l.size(); ++i) {
+ const int listSize(l.size());
+ for (int i = 0; i < listSize; ++i) {
const QByteArray key = l.at(i);
if (key == "QUERYLANGUAGE") {
// Skip the value
@@ -155,6 +157,7 @@ void PersistentSearchAttribute::deserialize(const QByteArray &data)
QList<QByteArray> ids;
ImapParser::parseParenthesizedList(l.at(i + 1), ids);
d->queryCollections.clear();
+ d->queryCollections.reserve(ids.count());
Q_FOREACH (const QByteArray &id, ids) {
d->queryCollections << id.toLongLong();
}