[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - wsd/ClientSession.cpp wsd/TileCache.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 11 16:52:32 UTC 2020
wsd/ClientSession.cpp | 2 +-
wsd/TileCache.cpp | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
New commits:
commit 4c52584ae14593e8756bcde0b094998238a0ff97
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Jun 9 22:24:13 2020 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Aug 11 18:52:13 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>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100504
Tested-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index a03bf5927..7e9cf8d40 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -1632,7 +1632,7 @@ Authorization ClientSession::getAuthorization() const
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