yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

loader/{nca, nro}: std::move VirtualFile in the constructors where applicable

This avoids unnecessary atomic reference count increments and decrements
This commit is contained in:
Lioncash 2018-07-20 00:10:21 -04:00
parent 0e9d58e82a
commit 8874d0e657
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <utility>
#include <vector> #include <vector>
#include "common/file_util.h" #include "common/file_util.h"
@ -21,7 +22,7 @@
namespace Loader { namespace Loader {
AppLoader_NCA::AppLoader_NCA(FileSys::VirtualFile file) : AppLoader(file) {} AppLoader_NCA::AppLoader_NCA(FileSys::VirtualFile file) : AppLoader(std::move(file)) {}
FileType AppLoader_NCA::IdentifyType(const FileSys::VirtualFile& file) { FileType AppLoader_NCA::IdentifyType(const FileSys::VirtualFile& file) {
// TODO(DarkLordZach): Assuming everything is decrypted. Add crypto support. // TODO(DarkLordZach): Assuming everything is decrypted. Add crypto support.

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <utility>
#include <vector> #include <vector>
#include "common/common_funcs.h" #include "common/common_funcs.h"
@ -48,7 +49,7 @@ struct ModHeader {
}; };
static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size."); static_assert(sizeof(ModHeader) == 0x1c, "ModHeader has incorrect size.");
AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file) : AppLoader(file) {} AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file) : AppLoader(std::move(file)) {}
FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) { FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) {
// Read NSO header // Read NSO header