From 01859cc12126b7205f5b54d383a9aa88db756f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sat, 16 Jan 2016 00:24:54 +0000 Subject: Reduce allocations by using reserve() Change-Id: If34fa53402985f6b3c5e7217bce4a1177af835b6 Reviewed-by: Marc Mutz --- src/testlib/qtestcase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/testlib/qtestcase.cpp') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 36eff6ac98..339db2246e 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1563,7 +1563,9 @@ static void qPrintDataTags(FILE *stream) member.resize(qstrlen(slot) + qstrlen("_data()") + 1); qsnprintf(member.data(), member.size(), "%s_data()", slot); invokeMethod(QTest::currentTestObject, member.constData()); - for (int j = 0; j < table.dataCount(); ++j) + const int dataCount = table.dataCount(); + localTags.reserve(dataCount); + for (int j = 0; j < dataCount; ++j) localTags << QLatin1String(table.testData(j)->dataTag()); // Print all tag combinations: -- cgit v1.2.3