mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 18:08:52 +00:00
Merge pull request #4936
7d9aeb7
easylogging++: avoid uneeded temporary std::string object (moneromooo-monero)
This commit is contained in:
commit
f03f4ddb96
15
external/easylogging++/easylogging++.cc
vendored
15
external/easylogging++/easylogging++.cc
vendored
@ -2130,24 +2130,23 @@ static int priority(Level level) {
|
|||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VRegistry::allowed(Level level, const char* category) {
|
bool VRegistry::allowed(Level level, const std::string &category) {
|
||||||
base::threading::ScopedLock scopedLock(lock());
|
base::threading::ScopedLock scopedLock(lock());
|
||||||
const std::string scategory = category;
|
const std::map<std::string, int>::const_iterator it = m_cached_allowed_categories.find(category);
|
||||||
const std::map<std::string, int>::const_iterator it = m_cached_allowed_categories.find(scategory);
|
|
||||||
if (it != m_cached_allowed_categories.end())
|
if (it != m_cached_allowed_categories.end())
|
||||||
return priority(level) <= it->second;
|
return priority(level) <= it->second;
|
||||||
if (m_categories.empty() || category == nullptr) {
|
if (m_categories.empty()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
std::vector<std::pair<std::string, Level>>::const_reverse_iterator it = m_categories.rbegin();
|
std::vector<std::pair<std::string, Level>>::const_reverse_iterator it = m_categories.rbegin();
|
||||||
for (; it != m_categories.rend(); ++it) {
|
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);
|
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;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2715,7 +2714,7 @@ void Writer::initializeLogger(const std::string& loggerId, bool lookup, bool nee
|
|||||||
}
|
}
|
||||||
if (ELPP->hasFlag(LoggingFlag::HierarchicalLogging)) {
|
if (ELPP->hasFlag(LoggingFlag::HierarchicalLogging)) {
|
||||||
m_proceed = m_level == Level::Verbose ? m_logger->enabled(m_level) :
|
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 {
|
} else {
|
||||||
m_proceed = m_logger->enabled(m_level);
|
m_proceed = m_logger->enabled(m_level);
|
||||||
}
|
}
|
||||||
|
2
external/easylogging++/easylogging++.h
vendored
2
external/easylogging++/easylogging++.h
vendored
@ -2463,7 +2463,7 @@ class VRegistry : base::NoCopy, public base::threading::ThreadSafe {
|
|||||||
|
|
||||||
void setModules(const char* modules);
|
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);
|
bool allowed(base::type::VerboseLevel vlevel, const char* file);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user