summaryrefslogtreecommitdiff
path: root/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
diff options
context:
space:
mode:
authorSergio Martins <sergio.martins@kdab.com>2015-05-28 12:34:03 +0100
committerSérgio Martins <sergio.martins@kdab.com>2015-05-28 15:43:50 +0000
commit4a6ce5c34b65df043df36c46ba03a45e36ff0c95 (patch)
tree72301915bbca7392628cabaabef8682f2c905555 /src/xmlpatterns/api/qabstractxmlnodemodel.cpp
parent5eb09c649e399ee6f3d4101d4cfb4c802f9da5e3 (diff)
downloadqtxmlpatterns-4a6ce5c34b65df043df36c46ba03a45e36ff0c95.tar.gz
Use QVector::reserve()
Change-Id: I86391bf0ede4fb32037b4e98889650e36ef5d279 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/xmlpatterns/api/qabstractxmlnodemodel.cpp')
-rw-r--r--src/xmlpatterns/api/qabstractxmlnodemodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
index 1a24dcc..1779454 100644
--- a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
+++ b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp
@@ -483,8 +483,9 @@ namespace QPatternist
virtual QAbstractXmlForwardIterator<QXmlNodeModelIndexIteratorPointer>::Ptr copy() const
{
ItVector result;
-
- for(int i = 0; i < m_list.count(); ++i)
+ const int count = m_list.count();
+ result.reserve(count);
+ for (int i = 0; i < count; ++i)
result.append(m_list.at(i)->copy());
return Ptr(new IteratorVector(result));
@@ -501,6 +502,7 @@ static inline QXmlNodeModelIndexIteratorPointer mergeIterators(const QXmlNodeMod
const QXmlNodeModelIndexIteratorPointer &it2)
{
QVector<QXmlNodeModelIndexIteratorPointer> iterators;
+ iterators.reserve(2);
iterators.append(makeSingletonIterator(node));
iterators.append(it2);