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 committed by fearlessTobi
parent edbdbf0ba1
commit 0cb7654d60
2 changed files with 2 additions and 6 deletions

View file

@ -143,9 +143,7 @@ void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager)
void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelSystem& kernel) { void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelSystem& kernel) {
ASSERT(port == nullptr); ASSERT(port == nullptr);
SharedPtr<ServerPort> server_port; auto [server_port, client_port] = kernel.CreatePortPair(max_sessions, service_name);
SharedPtr<ClientPort> client_port;
std::tie(server_port, client_port) = kernel.CreatePortPair(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));
} }

View file

@ -40,9 +40,7 @@ ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> ServiceManager::RegisterService
if (registered_services.find(name) != registered_services.end()) if (registered_services.find(name) != registered_services.end())
return ERR_ALREADY_REGISTERED; return ERR_ALREADY_REGISTERED;
Kernel::SharedPtr<Kernel::ServerPort> server_port; auto [server_port, client_port] = system.Kernel().CreatePortPair(max_sessions, name);
Kernel::SharedPtr<Kernel::ClientPort> client_port;
std::tie(server_port, client_port) = system.Kernel().CreatePortPair(max_sessions, name);
registered_services.emplace(std::move(name), std::move(client_port)); registered_services.emplace(std::move(name), std::move(client_port));
return MakeResult<Kernel::SharedPtr<Kernel::ServerPort>>(std::move(server_port)); return MakeResult<Kernel::SharedPtr<Kernel::ServerPort>>(std::move(server_port));