From f41883f2f33e466c55bc1ce6872e86151e269f46 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sat, 26 Nov 2016 16:19:00 +0100 Subject: [PATCH] Known size, reserve. --- core/device.cpp | 1 + plugins/sendnotifications/sendnotifications_config.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/device.cpp b/core/device.cpp index df3df06c3..11ca35c76 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -306,6 +306,7 @@ bool Device::isTrusted() const QStringList Device::availableLinks() const { QStringList sl; + sl.reserve(m_deviceLinks.size()); Q_FOREACH(DeviceLink* dl, m_deviceLinks) { sl.append(dl->provider()->name()); } diff --git a/plugins/sendnotifications/sendnotifications_config.cpp b/plugins/sendnotifications/sendnotifications_config.cpp index 4a49d35b4..7fc9e8f66 100644 --- a/plugins/sendnotifications/sendnotifications_config.cpp +++ b/plugins/sendnotifications/sendnotifications_config.cpp @@ -109,8 +109,10 @@ void SendNotificationsConfig::save() config()->set(QStringLiteral("generalUrgency"), m_ui->spin_urgency->value()); QVariantList list; - for (const auto& a: appModel->apps()) - list << QVariant::fromValue(a); + list.reserve(appModel->apps().size()); + for (const auto& a: appModel->apps()) { + list.append(QVariant::fromValue(a)); + } config()->setList(QStringLiteral("applications"), list); KCModule::save(); Q_EMIT changed(false);