diff options
author | Sérgio Martins <sergio.martins@kdab.com> | 2015-06-06 16:57:33 +0100 |
---|---|---|
committer | Sérgio Martins <sergio.martins@kdab.com> | 2015-06-08 11:35:42 +0000 |
commit | 52d91eeea4f49d36c18efd39e12f2634992cb63b (patch) | |
tree | 59cd35f687bcf5b4d02ce6ce24fc8362fa58a171 /tools | |
parent | 1790d374718308dc530b14eb004d1504baa2a5c6 (diff) | |
download | qtdeclarative-52d91eeea4f49d36c18efd39e12f2634992cb63b.tar.gz qtdeclarative-52d91eeea4f49d36c18efd39e12f2634992cb63b.tar.bz2 qtdeclarative-52d91eeea4f49d36c18efd39e12f2634992cb63b.zip |
Add 28 QList::reserve() calls
Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmleasing/splineeditor.cpp | 5 | ||||
-rw-r--r-- | tools/qmlplugindump/main.cpp | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp index a2ddc056d..b957cab4f 100644 --- a/tools/qmleasing/splineeditor.cpp +++ b/tools/qmleasing/splineeditor.cpp @@ -680,6 +680,7 @@ void SplineEditor::setEasingCurve(const QString &code) const QStringList stringList = cleanCode.split(QLatin1Char(','), QString::SkipEmptyParts); if (stringList.count() >= 6 && (stringList.count() % 6 == 0)) { QList<qreal> realList; + realList.reserve(stringList.count()); foreach (const QString &string, stringList) { bool ok; realList.append(string.toDouble(&ok)); @@ -687,7 +688,9 @@ void SplineEditor::setEasingCurve(const QString &code) return; } QList<QPointF> points; - for (int i = 0; i < realList.count() / 2; ++i) + const int count = realList.count() / 2; + points.reserve(count); + for (int i = 0; i < count; ++i) points.append(QPointF(realList.at(i * 2), realList.at(i * 2 + 1))); if (points.last() == QPointF(1.0, 1.0)) { QEasingCurve easingCurve(QEasingCurve::BezierSpline); diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 96c23ae26..c7539ac87 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -685,7 +685,9 @@ private: qml->writeScriptBinding(QLatin1String("name"), enquote(QString::fromUtf8(e.name()))); QList<QPair<QString, QString> > namesValues; - for (int index = 0; index < e.keyCount(); ++index) { + const int keyCount = e.keyCount(); + namesValues.reserve(keyCount); + for (int index = 0; index < keyCount; ++index) { namesValues.append(qMakePair(enquote(QString::fromUtf8(e.key(index))), QString::number(e.value(index)))); } |