1
1
Fork 0
forked from suyu/suyu

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
parent 864280fabc
commit 04d265562f
2 changed files with 7 additions and 7 deletions

View file

@ -39,9 +39,8 @@ void ServerPort::Acquire(Thread* thread) {
ASSERT_MSG(!ShouldWait(thread), "object unavailable!"); ASSERT_MSG(!ShouldWait(thread), "object unavailable!");
} }
std::tuple<SharedPtr<ServerPort>, SharedPtr<ClientPort>> ServerPort::CreatePortPair( ServerPort::PortPair ServerPort::CreatePortPair(KernelCore& kernel, u32 max_sessions,
KernelCore& kernel, u32 max_sessions, std::string name) { std::string name) {
SharedPtr<ServerPort> server_port(new ServerPort(kernel)); SharedPtr<ServerPort> server_port(new ServerPort(kernel));
SharedPtr<ClientPort> client_port(new ClientPort(kernel)); SharedPtr<ClientPort> client_port(new ClientPort(kernel));
@ -51,7 +50,7 @@ std::tuple<SharedPtr<ServerPort>, SharedPtr<ClientPort>> ServerPort::CreatePortP
client_port->max_sessions = max_sessions; client_port->max_sessions = max_sessions;
client_port->active_sessions = 0; client_port->active_sessions = 0;
return std::make_tuple(std::move(server_port), std::move(client_port)); return std::make_pair(std::move(server_port), std::move(client_port));
} }
} // namespace Kernel } // namespace Kernel

View file

@ -6,7 +6,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <tuple> #include <utility>
#include <vector> #include <vector>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
@ -23,6 +23,7 @@ class SessionRequestHandler;
class ServerPort final : public WaitObject { class ServerPort final : public WaitObject {
public: public:
using HLEHandler = std::shared_ptr<SessionRequestHandler>; using HLEHandler = std::shared_ptr<SessionRequestHandler>;
using PortPair = std::pair<SharedPtr<ServerPort>, SharedPtr<ClientPort>>;
/** /**
* Creates a pair of ServerPort and an associated ClientPort. * Creates a pair of ServerPort and an associated ClientPort.
@ -32,8 +33,8 @@ public:
* @param name Optional name of the ports * @param name Optional name of the ports
* @return The created port tuple * @return The created port tuple
*/ */
static std::tuple<SharedPtr<ServerPort>, SharedPtr<ClientPort>> CreatePortPair( static PortPair CreatePortPair(KernelCore& kernel, u32 max_sessions,
KernelCore& kernel, u32 max_sessions, std::string name = "UnknownPort"); std::string name = "UnknownPort");
std::string GetTypeName() const override { std::string GetTypeName() const override {
return "ServerPort"; return "ServerPort";