[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - common/Util.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Apr 14 18:56:27 UTC 2019
common/Util.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
New commits:
commit aac0708fe85d98cc320ad735e9379537e13798e5
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Apr 14 14:14:12 2019 -0400
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Sun Apr 14 20:56:07 2019 +0200
wsd: Use unordered map for anonymization
And simplify the trace-logging enablement check.
Change-Id: I4f5c9e08912b8dbc708b191b80032660ce4e1ba0
Reviewed-on: https://gerrit.libreoffice.org/70742
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/common/Util.cpp b/common/Util.cpp
index caea764a4..b0b870605 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -37,6 +37,7 @@
#include <iomanip>
#include <iostream>
#include <mutex>
+#include <unordered_map>
#include <random>
#include <sstream>
#include <string>
@@ -650,7 +651,7 @@ namespace Util
return std::make_tuple(base, filename, ext, params);
}
- static std::map<std::string, std::string> AnonymizedStrings;
+ static std::unordered_map<std::string, std::string> AnonymizedStrings;
static std::atomic<unsigned> AnonymizationCounter(0);
static std::mutex AnonymizedMutex;
@@ -659,8 +660,7 @@ namespace Util
if (plain.empty() || anonymized.empty())
return;
- auto &log = Log::logger();
- if (log.trace() && plain != anonymized)
+ if (Log::traceEnabled() && plain != anonymized)
LOG_TRC("Anonymizing [" << plain << "] -> [" << anonymized << "].");
std::unique_lock<std::mutex> lock(AnonymizedMutex);
@@ -676,8 +676,7 @@ namespace Util
const auto it = AnonymizedStrings.find(text);
if (it != AnonymizedStrings.end())
{
- auto &log = Log::logger();
- if (log.trace() && text != it->second)
+ if (Log::traceEnabled() && text != it->second)
LOG_TRC("Found anonymized [" << text << "] -> [" << it->second << "].");
return it->second;
}
More information about the Libreoffice-commits
mailing list