hle/service, hle/sm: Use structured bindings where applicable

Gets rid of the need to keep the variables separate from their actual
initialization spots.
This commit is contained in:
Lioncash 2018-12-06 01:29:17 -05:00
parent 4d3d2fcebd
commit a8269fdae3
2 changed files with 3 additions and 9 deletions

View file

@ -110,9 +110,7 @@ void ServiceFrameworkBase::InstallAsNamedPort() {
ASSERT(port == nullptr); ASSERT(port == nullptr);
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = Core::System::GetInstance().Kernel();
SharedPtr<ServerPort> server_port; auto [server_port, client_port] =
SharedPtr<ClientPort> client_port;
std::tie(server_port, client_port) =
ServerPort::CreatePortPair(kernel, max_sessions, service_name); ServerPort::CreatePortPair(kernel, max_sessions, service_name);
server_port->SetHleHandler(shared_from_this()); server_port->SetHleHandler(shared_from_this());
kernel.AddNamedPort(service_name, std::move(client_port)); kernel.AddNamedPort(service_name, std::move(client_port));
@ -122,9 +120,7 @@ Kernel::SharedPtr<Kernel::ClientPort> ServiceFrameworkBase::CreatePort() {
ASSERT(port == nullptr); ASSERT(port == nullptr);
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = Core::System::GetInstance().Kernel();
Kernel::SharedPtr<Kernel::ServerPort> server_port; auto [server_port, client_port] =
Kernel::SharedPtr<Kernel::ClientPort> client_port;
std::tie(server_port, client_port) =
Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name); Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name);
port = MakeResult<Kernel::SharedPtr<Kernel::ServerPort>>(std::move(server_port)).Unwrap(); port = MakeResult<Kernel::SharedPtr<Kernel::ServerPort>>(std::move(server_port)).Unwrap();
port->SetHleHandler(shared_from_this()); port->SetHleHandler(shared_from_this());

View file

@ -54,9 +54,7 @@ ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> ServiceManager::RegisterService
return ERR_ALREADY_REGISTERED; return ERR_ALREADY_REGISTERED;
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = Core::System::GetInstance().Kernel();
Kernel::SharedPtr<Kernel::ServerPort> server_port; auto [server_port, client_port] =
Kernel::SharedPtr<Kernel::ClientPort> client_port;
std::tie(server_port, client_port) =
Kernel::ServerPort::CreatePortPair(kernel, max_sessions, name); Kernel::ServerPort::CreatePortPair(kernel, max_sessions, name);
registered_services.emplace(std::move(name), std::move(client_port)); registered_services.emplace(std::move(name), std::move(client_port));