aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlproperty.cpp
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2015-06-06 16:57:33 +0100
committerSérgio Martins <sergio.martins@kdab.com>2015-06-08 11:35:42 +0000
commit52d91eeea4f49d36c18efd39e12f2634992cb63b (patch)
tree59cd35f687bcf5b4d02ce6ce24fc8362fa58a171 /src/qml/qml/qqmlproperty.cpp
parent1790d374718308dc530b14eb004d1504baa2a5c6 (diff)
Add 28 QList::reserve() calls
Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r--src/qml/qml/qqmlproperty.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 997859d410..e4b2743b9b 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1085,16 +1085,22 @@ QVariant QQmlPropertyPrivate::resolvedUrlSequence(const QVariant &value, QQmlCon
urls = value.value<QList<QUrl> >();
} else if (value.userType() == qMetaTypeId<QStringList>()) {
QStringList urlStrings = value.value<QStringList>();
- for (int i = 0; i < urlStrings.size(); ++i)
+ const int urlStringsSize = urlStrings.size();
+ urls.reserve(urlStringsSize);
+ for (int i = 0; i < urlStringsSize; ++i)
urls.append(QUrl(urlStrings.at(i)));
} else if (value.userType() == qMetaTypeId<QList<QString> >()) {
QList<QString> urlStrings = value.value<QList<QString> >();
- for (int i = 0; i < urlStrings.size(); ++i)
+ const int urlStringsSize = urlStrings.size();
+ urls.reserve(urlStringsSize);
+ for (int i = 0; i < urlStringsSize; ++i)
urls.append(QUrl(urlStrings.at(i)));
} // note: QList<QByteArray> is not currently supported.
QList<QUrl> resolvedUrls;
- for (int i = 0; i < urls.size(); ++i) {
+ const int urlsSize = urls.size();
+ resolvedUrls.reserve(urlsSize);
+ for (int i = 0; i < urlsSize; ++i) {
QUrl u = urls.at(i);
if (context && u.isRelative() && !u.isEmpty())
u = context->resolvedUrl(u);