QByteArrayList: optimize op+

The old code creates a default-constructed QByteArrayList, then performed two
list-appends, the first one of which just performs assignment.

Optimize by replacing the default construction and assignment with a copy
constructor call.

Change-Id: I6d5bd14172798c925b05bd3602e6d1d037d90796
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This commit is contained in:
Marc Mutz 2014-02-20 22:55:22 +01:00 committed by The Qt Project
parent 328a282ebd
commit f12b0f9a38

View File

@ -97,9 +97,8 @@ inline QByteArray QByteArrayList::join(char sep) const
inline QByteArrayList operator+(const QByteArrayList &lhs, const QByteArrayList &rhs)
{
QByteArrayList res;
res.append( lhs );
res.append( rhs );
QByteArrayList res = lhs;
res += rhs;
return res;
}