From fbb82e61e35a4e40154ad9a9fcb1ecc46f6622b8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 7 Mar 2019 16:44:28 -0500 Subject: kernel/hle_ipc: Convert std::shared_ptr IPC header instances to std::optional There's no real need to use a shared lifetime here, since we don't actually expose them to anything else. This is also kind of an unnecessary use of the heap given the objects themselves are so small; small enough, in fact that changing over to optionals actually reduces the overall size of the HLERequestContext struct (818 bytes to 808 bytes). --- src/core/hle/kernel/hle_ipc.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/core/hle/kernel/hle_ipc.h') diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 0107acea4..2bdd9f02c 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -168,12 +169,12 @@ public: return buffer_c_desciptors; } - const IPC::DomainMessageHeader* GetDomainMessageHeader() const { - return domain_message_header.get(); + const IPC::DomainMessageHeader& GetDomainMessageHeader() const { + return domain_message_header.value(); } bool HasDomainMessageHeader() const { - return domain_message_header != nullptr; + return domain_message_header.has_value(); } /// Helper function to read a buffer using the appropriate buffer descriptor @@ -272,10 +273,10 @@ private: boost::container::small_vector, 8> copy_objects; boost::container::small_vector, 8> domain_objects; - std::shared_ptr command_header; - std::shared_ptr handle_descriptor_header; - std::shared_ptr data_payload_header; - std::shared_ptr domain_message_header; + std::optional command_header; + std::optional handle_descriptor_header; + std::optional data_payload_header; + std::optional domain_message_header; std::vector buffer_x_desciptors; std::vector buffer_a_desciptors; std::vector buffer_b_desciptors; -- cgit v1.2.3