QMimeData: use reserve in formats()

... to optimize memory allocation.

Change-Id: I039a6de6f97858f339b83ca7e3e361963eaa61ee
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Anton Kudryavtsev 2016-01-24 16:57:08 +03:00
parent 451273523d
commit 7ee1fc4c29

View File

@ -628,7 +628,9 @@ QStringList QMimeData::formats() const
{
Q_D(const QMimeData);
QStringList list;
for (int i=0; i<d->dataList.size(); i++)
const int size = d->dataList.size();
list.reserve(size);
for (int i = 0; i < size; ++i)
list += d->dataList.at(i).format;
return list;
}