kernel/server_port: Return a std::pair from CreatePortPair()

Returns the same type that the function name describes.
This commit is contained in:
Lioncash
2019-04-06 01:36:50 -04:00
committed by fearlessTobi
parent 11754778bb
commit 1afc2c72d6
3 changed files with 8 additions and 11 deletions

View File

@ -1292,13 +1292,11 @@ ResultCode SVC::CreatePort(Handle* server_port, Handle* client_port, VAddr name_
std::shared_ptr<Process> current_process = kernel.GetCurrentProcess();
auto ports = kernel.CreatePortPair(max_sessions);
CASCADE_RESULT(*client_port, current_process->handle_table.Create(
std::move(std::get<std::shared_ptr<ClientPort>>(ports))));
auto [server, client] = kernel.CreatePortPair(max_sessions);
CASCADE_RESULT(*client_port, current_process->handle_table.Create(std::move(client)));
// Note: The 3DS kernel also leaks the client port handle if the server port handle fails to be
// created.
CASCADE_RESULT(*server_port, current_process->handle_table.Create(
std::move(std::get<std::shared_ptr<ServerPort>>(ports))));
CASCADE_RESULT(*server_port, current_process->handle_table.Create(std::move(server)));
LOG_TRACE(Kernel_SVC, "called max_sessions={}", max_sessions);
return RESULT_SUCCESS;