From 6636f3ff4717886f48b7cd238cd75315952cb112 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 9 Oct 2018 14:22:31 -0400 Subject: patch_manager: Return a std::unique_ptr from ParseControlNCA() and GetControlMetadata() instead of a std::shared_ptr Neither of these functions require the use of shared ownership of the returned pointer. This makes it more difficult to create reference cycles with, and makes the interface more generic, as std::shared_ptr instances can be created from a std::unique_ptr, but the vice-versa isn't possible. This also alters relevant functions to take NCA arguments by const reference rather than a const reference to a std::shared_ptr. These functions don't alter the ownership of the memory used by the NCA instance, so we can make the interface more generic by not assuming anything about the type of smart pointer the NCA is contained within and make it the caller's responsibility to ensure the supplied NCA is valid. --- src/core/loader/nsp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/loader/nsp.h') diff --git a/src/core/loader/nsp.h b/src/core/loader/nsp.h index b006594a6..db91cd01e 100644 --- a/src/core/loader/nsp.h +++ b/src/core/loader/nsp.h @@ -49,7 +49,7 @@ private: std::unique_ptr secondary_loader; FileSys::VirtualFile icon_file; - std::shared_ptr nacp_file; + std::unique_ptr nacp_file; u64 title_id; }; -- cgit v1.2.3