[Libreoffice-commits] online.git: test/httpwstest.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 26 08:43:41 UTC 2018


 test/httpwstest.cpp |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 54e4147887d70de73b30e5c002cd1bde5cd9d5b6
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Nov 26 09:43:17 2018 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Nov 26 09:43:17 2018 +0100

    httpwstest: 'emplace_back' is called inside a loop
    
    Pre-allocate the vector capacity before the loop to avoid realloc waste.
    
    Change-Id: I78370d79728ae66446d2b979d376cb50ba3ae864

diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index f0aee365a..1395624a5 100644
--- a/test/httpwstest.cpp
+++ b/test/httpwstest.cpp
@@ -585,6 +585,7 @@ void HTTPWSTest::testLoadTorture()
     std::vector<std::string> docNames = { "setclientpart.ods", "hello.odt", "viewcursor.odp" };
 
     std::vector<std::thread> threads;
+    threads.reserve(docNames.size());
     for (const auto& docName : docNames)
     {
         threads.emplace_back([&]


More information about the Libreoffice-commits mailing list