common/Log.cpp | 3 ++- common/Log.hpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
New commits: commit bc67163a481d02d76266875372af5ff79a861d23 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Sat Apr 27 22:00:51 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat Apr 27 22:04:33 2019 +0100 Reset the stringstream properly. Avoids some N^2 log-line explosion; also make the method name more findable. Change-Id: I3ee8c521f1ac98a939cd4d758c720b577d3bfa57 Reviewed-on: https://gerrit.libreoffice.org/71443 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/common/Log.cpp b/common/Log.cpp index 3bedaa82e..f1ed70dcb 100644 --- a/common/Log.cpp +++ b/common/Log.cpp @@ -134,10 +134,11 @@ namespace Log // Reuse the same buffer to minimize memory fragmentation. static thread_local std::ostringstream Oss; - std::ostringstream& begin(const char* level) + std::ostringstream& beginLog(const char* level) { // Reset the oss. Oss.clear(); + Oss.str(std::string()); Oss.seekp(0); // Output the prefix. diff --git a/common/Log.hpp b/common/Log.hpp index 9ded1425a..a17509317 100644 --- a/common/Log.hpp +++ b/common/Log.hpp @@ -51,7 +51,7 @@ namespace Log char* prefix(char* buffer, std::size_t len, const char* level); /// Starts logging by generating the prefix and returning an oss. - std::ostringstream& begin(const char* level); + std::ostringstream& beginLog(const char* level); inline bool traceEnabled() { return logger().trace(); } inline bool debugEnabled() { return logger().debug(); } @@ -245,7 +245,7 @@ namespace Log #define LOG_BODY_(LOG, PRIO, LVL, X, FILEP) \ Poco::Message m_(LOG.name(), "", Poco::Message::PRIO_##PRIO); \ - std::ostringstream& oss_ = Log::begin(LVL); \ + std::ostringstream& oss_ = Log::beginLog(LVL); \ oss_ << X; \ LOG_END(oss_, FILEP); \ m_.setText(oss_.str()); \ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits