From 6e48149ee1c04e335f47e2855a27d3baa7aa2c89 Mon Sep 17 00:00:00 2001 From: Mat M Date: Mon, 4 May 2020 06:22:13 -0400 Subject: [PATCH] fs/archive: Make use of std::make_shared where applicable (#5319) Allows implementations to allocate the object and the shared_ptr control block in one allocation instead of needing to do two separate allocations. Also looks much nicer to the reader. --- src/core/hle/service/fs/archive.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 8da2bf52e8..c2443c2b9b 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -91,7 +91,7 @@ ArchiveManager::OpenFileFromArchive(ArchiveHandle archive_handle, const FileSys: if (backend.Failed()) return std::make_tuple(backend.Code(), open_timeout_ns); - auto file = std::shared_ptr(new File(system.Kernel(), std::move(backend).Unwrap(), path)); + auto file = std::make_shared(system.Kernel(), std::move(backend).Unwrap(), path); return std::make_tuple(MakeResult>(std::move(file)), open_timeout_ns); } @@ -184,7 +184,7 @@ ResultVal> ArchiveManager::OpenDirectoryFromArchive( if (backend.Failed()) return backend.Code(); - auto directory = std::shared_ptr(new Directory(std::move(backend).Unwrap(), path)); + auto directory = std::make_shared(std::move(backend).Unwrap(), path); return MakeResult>(std::move(directory)); }