[Libreoffice-commits] online.git: wsd/ClientSession.cpp wsd/TileCache.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 1 05:41:14 UTC 2020
wsd/ClientSession.cpp | 2 +-
wsd/TileCache.cpp | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
New commits:
commit a77208ddfba03faf2df575d9a43cc21d65f93fd0
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Jun 9 22:24:13 2020 -0400
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Wed Jul 1 07:40:54 2020 +0200
wsd: prefer emplace_back where possible
emplace_back avoids copy-construction when
the argument is a temporary instance created
at call-site.
Change-Id: I127fddd308d710af9ea65a86db1b03347e9c3d87
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96829
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 26f9e9c8b..5f79a07fa 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -1574,7 +1574,7 @@ void ClientSession::enqueueSendMessage(const std::shared_ptr<Message>& data)
void ClientSession::addTileOnFly(const TileDesc& tile)
{
- _tilesOnFly.push_back({tile.generateID(), std::chrono::steady_clock::now()});
+ _tilesOnFly.emplace_back(tile.generateID(), std::chrono::steady_clock::now());
}
void ClientSession::clearTilesOnFly()
diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp
index 12231a383..4e9773499 100644
--- a/wsd/TileCache.cpp
+++ b/wsd/TileCache.cpp
@@ -589,9 +589,8 @@ void TileCache::ensureCacheSize()
WidSize(TileWireId w, size_t s) : _wid(w), _size(s) {}
};
std::vector<WidSize> wids;
- for (auto &it : _cache)
- wids.push_back(WidSize(it.first.getWireId(),
- itemCacheSize(it.second)));
+ for (const auto& it : _cache)
+ wids.emplace_back(it.first.getWireId(), itemCacheSize(it.second));
std::sort(wids.begin(), wids.end(),
[](const WidSize &a, const WidSize &b) { return a._wid < b._wid; });
More information about the Libreoffice-commits
mailing list