summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-07-20 21:27:17 +0200
committerLioncash <mathew1800@gmail.com>2018-07-20 21:27:20 +0200
commit457d1b4490dbc293246f372532a81a9e90d366c4 (patch)
tree93eb2026cadad03ab9d52be843a9446ff180ecf0 /src
parentMerge pull request #740 from Subv/acc_crash (diff)
downloadyuzu-457d1b4490dbc293246f372532a81a9e90d366c4.tar
yuzu-457d1b4490dbc293246f372532a81a9e90d366c4.tar.gz
yuzu-457d1b4490dbc293246f372532a81a9e90d366c4.tar.bz2
yuzu-457d1b4490dbc293246f372532a81a9e90d366c4.tar.lz
yuzu-457d1b4490dbc293246f372532a81a9e90d366c4.tar.xz
yuzu-457d1b4490dbc293246f372532a81a9e90d366c4.tar.zst
yuzu-457d1b4490dbc293246f372532a81a9e90d366c4.zip
Diffstat (limited to 'src')
-rw-r--r--src/common/logging/backend.cpp20
-rw-r--r--src/common/logging/backend.h5
2 files changed, 13 insertions, 12 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index ed1e93cc2..3745af9df 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -48,11 +48,11 @@ public:
backends.push_back(std::move(backend));
}
- void RemoveBackend(const std::string& backend_name) {
+ void RemoveBackend(std::string_view backend_name) {
std::lock_guard<std::mutex> lock(writing_mutex);
- auto it = std::remove_if(backends.begin(), backends.end(), [&backend_name](const auto& i) {
- return !strcmp(i->GetName(), backend_name.c_str());
- });
+ const auto it =
+ std::remove_if(backends.begin(), backends.end(),
+ [&backend_name](const auto& i) { return backend_name == i->GetName(); });
backends.erase(it, backends.end());
}
@@ -64,10 +64,10 @@ public:
filter = f;
}
- Backend* GetBackend(const std::string& backend_name) {
- auto it = std::find_if(backends.begin(), backends.end(), [&backend_name](const auto& i) {
- return !strcmp(i->GetName(), backend_name.c_str());
- });
+ Backend* GetBackend(std::string_view backend_name) {
+ const auto it =
+ std::find_if(backends.begin(), backends.end(),
+ [&backend_name](const auto& i) { return backend_name == i->GetName(); });
if (it == backends.end())
return nullptr;
return it->get();
@@ -265,11 +265,11 @@ void AddBackend(std::unique_ptr<Backend> backend) {
Impl::Instance().AddBackend(std::move(backend));
}
-void RemoveBackend(const std::string& backend_name) {
+void RemoveBackend(std::string_view backend_name) {
Impl::Instance().RemoveBackend(backend_name);
}
-Backend* GetBackend(const std::string& backend_name) {
+Backend* GetBackend(std::string_view backend_name) {
return Impl::Instance().GetBackend(backend_name);
}
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index 57cdf6b2d..45609a535 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -7,6 +7,7 @@
#include <cstdarg>
#include <memory>
#include <string>
+#include <string_view>
#include <utility>
#include "common/file_util.h"
#include "common/logging/filter.h"
@@ -106,9 +107,9 @@ private:
void AddBackend(std::unique_ptr<Backend> backend);
-void RemoveBackend(const std::string& backend_name);
+void RemoveBackend(std::string_view backend_name);
-Backend* GetBackend(const std::string& backend_name);
+Backend* GetBackend(std::string_view backend_name);
/**
* Returns the name of the passed log class as a C-string. Subclasses are separated by periods