kernel/server_session: Return a std::pair from CreateSessionPair()

Keeps the return type consistent with the function name. While we're at
it, we can also reduce the amount of boilerplate involved with handling
these by using structured bindings.
This commit is contained in:
Lioncash
2019-04-06 01:41:43 -04:00
committed by fearlessTobi
parent 1afc2c72d6
commit 42535468c3
7 changed files with 25 additions and 30 deletions

View File

@ -120,8 +120,8 @@ ResultCode ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread) {
return RESULT_SUCCESS;
}
std::tuple<std::shared_ptr<ServerSession>, std::shared_ptr<ClientSession>>
KernelSystem::CreateSessionPair(const std::string& name, std::shared_ptr<ClientPort> port) {
KernelSystem::SessionPair KernelSystem::CreateSessionPair(const std::string& name,
std::shared_ptr<ClientPort> port) {
auto server_session = ServerSession::Create(*this, name + "_Server").Unwrap();
auto client_session{std::make_shared<ClientSession>(*this)};
client_session->name = name + "_Client";
@ -134,7 +134,7 @@ KernelSystem::CreateSessionPair(const std::string& name, std::shared_ptr<ClientP
client_session->parent = parent;
server_session->parent = parent;
return std::make_tuple(std::move(server_session), std::move(client_session));
return std::make_pair(std::move(server_session), std::move(client_session));
}
} // namespace Kernel