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

partition_filesystem: Use std::move where applicable

Avoids copying a std::string instance and avoids unnecessary atomic
reference count incrementing and decrementing.
This commit is contained in:
Lioncash 2018-07-23 20:27:08 -04:00
parent 07e5319d55
commit db48ebb9c9
1 changed files with 3 additions and 3 deletions

View File

@ -65,8 +65,8 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr<VfsFile> file) {
std::string name( std::string name(
reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset])); reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset]));
pfs_files.emplace_back( pfs_files.emplace_back(std::make_shared<OffsetVfsFile>(
std::make_shared<OffsetVfsFile>(file, entry.size, content_offset + entry.offset, name)); file, entry.size, content_offset + entry.offset, std::move(name)));
} }
status = Loader::ResultStatus::Success; status = Loader::ResultStatus::Success;
@ -109,7 +109,7 @@ bool PartitionFilesystem::ReplaceFileWithSubdirectory(VirtualFile file, VirtualD
return false; return false;
const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter); const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter);
pfs_files[offset] = pfs_files.back(); pfs_files[offset] = std::move(pfs_files.back());
pfs_files.pop_back(); pfs_files.pop_back();
pfs_dirs.emplace_back(std::move(dir)); pfs_dirs.emplace_back(std::move(dir));