From a8269fdae345690f28742c5c39470fb9d40ca7cf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 6 Dec 2018 01:29:17 -0500 Subject: hle/service, hle/sm: Use structured bindings where applicable Gets rid of the need to keep the variables separate from their actual initialization spots. --- src/core/hle/service/service.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/core/hle/service/service.cpp') diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 1ec340466..7de2c5a40 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -110,9 +110,7 @@ void ServiceFrameworkBase::InstallAsNamedPort() { ASSERT(port == nullptr); auto& kernel = Core::System::GetInstance().Kernel(); - SharedPtr server_port; - SharedPtr client_port; - std::tie(server_port, client_port) = + auto [server_port, client_port] = ServerPort::CreatePortPair(kernel, max_sessions, service_name); server_port->SetHleHandler(shared_from_this()); kernel.AddNamedPort(service_name, std::move(client_port)); @@ -122,9 +120,7 @@ Kernel::SharedPtr ServiceFrameworkBase::CreatePort() { ASSERT(port == nullptr); auto& kernel = Core::System::GetInstance().Kernel(); - Kernel::SharedPtr server_port; - Kernel::SharedPtr client_port; - std::tie(server_port, client_port) = + auto [server_port, client_port] = Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name); port = MakeResult>(std::move(server_port)).Unwrap(); port->SetHleHandler(shared_from_this()); -- cgit v1.2.3 From d8625f5544dd0caba80d9ba0be51d0ba96414ae2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 6 Dec 2018 01:33:19 -0500 Subject: hle/service, hle/sm: Compress usages of MakeResult() These auto-deduce the result based off its arguments, so there's no need to do that work for the compiler, plus, the function return value itself already indicates what we're returning. --- src/core/hle/service/service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/service/service.cpp') diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 7de2c5a40..0ca234d50 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -122,7 +122,7 @@ Kernel::SharedPtr ServiceFrameworkBase::CreatePort() { auto& kernel = Core::System::GetInstance().Kernel(); auto [server_port, client_port] = Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name); - port = MakeResult>(std::move(server_port)).Unwrap(); + port = MakeResult(std::move(server_port)).Unwrap(); port->SetHleHandler(shared_from_this()); return client_port; } -- cgit v1.2.3 From 9f56477539cd3eabb9f06eb4827158c313d85712 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 6 Dec 2018 01:37:39 -0500 Subject: hle/service: Remove unnecessary using declarations Only one usage of the specified objects made use of the lack of namespacing. Given the low usage, we can just remove these. --- src/core/hle/service/service.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/core/hle/service/service.cpp') diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 0ca234d50..f061947f2 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -70,10 +70,6 @@ #include "core/hle/service/vi/vi.h" #include "core/hle/service/wlan/wlan.h" -using Kernel::ClientPort; -using Kernel::ServerPort; -using Kernel::SharedPtr; - namespace Service { /** @@ -111,7 +107,7 @@ void ServiceFrameworkBase::InstallAsNamedPort() { auto& kernel = Core::System::GetInstance().Kernel(); auto [server_port, client_port] = - ServerPort::CreatePortPair(kernel, max_sessions, service_name); + Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name); server_port->SetHleHandler(shared_from_this()); kernel.AddNamedPort(service_name, std::move(client_port)); } -- cgit v1.2.3 From 24f051d7234bf18bc3dd770f3707c1a140688c3f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 6 Dec 2018 01:40:21 -0500 Subject: hle/service: Replace log + UNIMPLEMENTED with UNIMPLEMENTED_MSG Combines the two into one, shortening the amount of code here. --- src/core/hle/service/service.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/hle/service/service.cpp') diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index f061947f2..d41df3732 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -144,8 +144,7 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext } buf.push_back('}'); - LOG_ERROR(Service, "unknown / unimplemented {}", fmt::to_string(buf)); - UNIMPLEMENTED(); + UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf)); } void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) { -- cgit v1.2.3