net/Socket.hpp | 4 ++-- wsd/Admin.cpp | 19 +++++++------------ wsd/AdminModel.cpp | 4 +--- 3 files changed, 10 insertions(+), 17 deletions(-)
New commits: commit 57d535b15b94c0b506c17ab68838168d422c5deb Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Tue Jan 2 21:33:52 2018 -0500 wsd: lambda cleanup and better readability Change-Id: Iabb850be7a7c162847514ee0fb600297accfcffb Reviewed-on: https://gerrit.libreoffice.org/47364 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/net/Socket.hpp b/net/Socket.hpp index 0b6af504..736be218 100644 --- a/net/Socket.hpp +++ b/net/Socket.hpp @@ -428,11 +428,11 @@ public: std::swap(_newCallbacks, invoke); } - for (size_t i = 0; i < invoke.size(); ++i) + for (const auto& callback : invoke) { try { - invoke[i](); + callback(); } catch (const std::exception& exc) { diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp index c3c121e7..f6ade65f 100644 --- a/wsd/Admin.cpp +++ b/wsd/Admin.cpp @@ -430,27 +430,24 @@ void Admin::pollingThread() } void Admin::modificationAlert(const std::string& dockey, Poco::Process::PID pid, bool value){ - addCallback([this, dockey, pid, value] - { _model.modificationAlert(dockey, pid, value); }); + addCallback([&] { _model.modificationAlert(dockey, pid, value); }); } void Admin::addDoc(const std::string& docKey, Poco::Process::PID pid, const std::string& filename, const std::string& sessionId, const std::string& userName, const std::string& userId) { - addCallback([this, docKey, pid, filename, sessionId, userName, userId] - { _model.addDocument(docKey, pid, filename, sessionId, userName, userId); }); + addCallback([&] { _model.addDocument(docKey, pid, filename, sessionId, userName, userId); }); } void Admin::rmDoc(const std::string& docKey, const std::string& sessionId) { - addCallback([this, docKey, sessionId] - { _model.removeDocument(docKey, sessionId); }); + addCallback([&] { _model.removeDocument(docKey, sessionId); }); } void Admin::rmDoc(const std::string& docKey) { LOG_INF("Removing complete doc [" << docKey << "] from Admin."); - addCallback([this, docKey]{ _model.removeDocument(docKey); }); + addCallback([&]{ _model.removeDocument(docKey); }); } void Admin::rescheduleMemTimer(unsigned interval) @@ -521,19 +518,17 @@ AdminModel& Admin::getModel() void Admin::updateLastActivityTime(const std::string& docKey) { - addCallback([this, docKey]{ _model.updateLastActivityTime(docKey); }); + addCallback([&]{ _model.updateLastActivityTime(docKey); }); } void Admin::updateMemoryDirty(const std::string& docKey, int dirty) { - addCallback([this, docKey, dirty] - { _model.updateMemoryDirty(docKey, dirty); }); + addCallback([&] { _model.updateMemoryDirty(docKey, dirty); }); } void Admin::addBytes(const std::string& docKey, uint64_t sent, uint64_t recv) { - addCallback([this, docKey, sent, recv] - { _model.addBytes(docKey, sent, recv); }); + addCallback([&] { _model.addBytes(docKey, sent, recv); }); } void Admin::notifyForkit() diff --git a/wsd/AdminModel.cpp b/wsd/AdminModel.cpp index ea0a0589..d23c39ae 100644 --- a/wsd/AdminModel.cpp +++ b/wsd/AdminModel.cpp @@ -449,10 +449,8 @@ void AdminModel::modificationAlert(const std::string& docKey, Poco::Process::PID assertCorrectThread(); auto doc = _documents.find(docKey); - if(doc != _documents.end()) - { + if (doc != _documents.end()) doc->second.setModified(value); - } std::ostringstream oss; oss << "modifications " _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits