From f12b0f9a38c792abb13f3e6ecff4542986a6f96b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 20 Feb 2014 22:55:22 +0100 Subject: QByteArrayList: optimize op+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qbytearraylist.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h index 5ce6509c28..882bc68f09 100644 --- a/src/corelib/tools/qbytearraylist.h +++ b/src/corelib/tools/qbytearraylist.h @@ -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; } -- cgit v1.2.3