aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-12-03 21:33:49 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-12-03 21:34:28 +0000
commit7d9aeb71958ceb1efad488200ee8ccf92510b583 (patch)
treea5149c182168641d1e91ed4afcb0e06ef582a579
parentMerge pull request #4821 (diff)
downloadmonero-7d9aeb71958ceb1efad488200ee8ccf92510b583.tar.xz
easylogging++: avoid uneeded temporary std::string object
-rw-r--r--external/easylogging++/easylogging++.cc15
-rw-r--r--external/easylogging++/easylogging++.h2
2 files changed, 8 insertions, 9 deletions
diff --git a/external/easylogging++/easylogging++.cc b/external/easylogging++/easylogging++.cc
index d57f3f3a0..800d9a4dd 100644
--- a/external/easylogging++/easylogging++.cc
+++ b/external/easylogging++/easylogging++.cc
@@ -2130,24 +2130,23 @@ static int priority(Level level) {
return 7;
}
-bool VRegistry::allowed(Level level, const char* category) {
+bool VRegistry::allowed(Level level, const std::string &category) {
base::threading::ScopedLock scopedLock(lock());
- const std::string scategory = category;
- const std::map<std::string, int>::const_iterator it = m_cached_allowed_categories.find(scategory);
+ const std::map<std::string, int>::const_iterator it = m_cached_allowed_categories.find(category);
if (it != m_cached_allowed_categories.end())
return priority(level) <= it->second;
- if (m_categories.empty() || category == nullptr) {
+ if (m_categories.empty()) {
return false;
} else {
std::vector<std::pair<std::string, Level>>::const_reverse_iterator it = m_categories.rbegin();
for (; it != m_categories.rend(); ++it) {
- if (base::utils::Str::wildCardMatch(category, it->first.c_str())) {
+ if (base::utils::Str::wildCardMatch(category.c_str(), it->first.c_str())) {
const int p = priority(it->second);
- m_cached_allowed_categories.insert(std::make_pair(std::move(scategory), p));
+ m_cached_allowed_categories.insert(std::make_pair(category, p));
return priority(level) <= p;
}
}
- m_cached_allowed_categories.insert(std::make_pair(std::move(scategory), -1));
+ m_cached_allowed_categories.insert(std::make_pair(category, -1));
return false;
}
}
@@ -2720,7 +2719,7 @@ void Writer::initializeLogger(const std::string& loggerId, bool lookup, bool nee
}
if (ELPP->hasFlag(LoggingFlag::HierarchicalLogging)) {
m_proceed = m_level == Level::Verbose ? m_logger->enabled(m_level) :
- ELPP->vRegistry()->allowed(m_level, loggerId.c_str());
+ ELPP->vRegistry()->allowed(m_level, loggerId);
} else {
m_proceed = m_logger->enabled(m_level);
}
diff --git a/external/easylogging++/easylogging++.h b/external/easylogging++/easylogging++.h
index 046252a5b..9edec9317 100644
--- a/external/easylogging++/easylogging++.h
+++ b/external/easylogging++/easylogging++.h
@@ -2463,7 +2463,7 @@ class VRegistry : base::NoCopy, public base::threading::ThreadSafe {
void setModules(const char* modules);
- bool allowed(Level level, const char* category);
+ bool allowed(Level level, const std::string &category);
bool allowed(base::type::VerboseLevel vlevel, const char* file);