minor optimization: use QList::reserve()

Reviewed-by: thiago
Reviewed-by: dt
(cherry picked from commit 6a53f17c7039f1a5405912a4a645572e215410bb)
This commit is contained in:
Oswald Buddenhagen 2011-04-21 17:31:06 +02:00 committed by Olivier Goffart
parent 9590b7b662
commit e608887ee4

View File

@ -190,6 +190,7 @@ template<> void QSharedDataPointer<QProcessEnvironmentPrivate>::detach()
QStringList QProcessEnvironmentPrivate::toList() const
{
QStringList result;
result.reserve(hash.size());
Hash::ConstIterator it = hash.constBegin(),
end = hash.constEnd();
for ( ; it != end; ++it) {
@ -224,6 +225,7 @@ QProcessEnvironment QProcessEnvironmentPrivate::fromList(const QStringList &list
QStringList QProcessEnvironmentPrivate::keys() const
{
QStringList result;
result.reserve(hash.size());
Hash::ConstIterator it = hash.constBegin(),
end = hash.constEnd();
for ( ; it != end; ++it)