From db48ebb9c9354a929a24b669851900eebc196110 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 23 Jul 2018 20:27:08 -0400 Subject: partition_filesystem: Use std::move where applicable Avoids copying a std::string instance and avoids unnecessary atomic reference count incrementing and decrementing. --- src/core/file_sys/partition_filesystem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp index 8d2bd9f6b..521e21078 100644 --- a/src/core/file_sys/partition_filesystem.cpp +++ b/src/core/file_sys/partition_filesystem.cpp @@ -65,8 +65,8 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr file) { std::string name( reinterpret_cast(&file_data[strtab_offset + entry.strtab_offset])); - pfs_files.emplace_back( - std::make_shared(file, entry.size, content_offset + entry.offset, name)); + pfs_files.emplace_back(std::make_shared( + file, entry.size, content_offset + entry.offset, std::move(name))); } status = Loader::ResultStatus::Success; @@ -109,7 +109,7 @@ bool PartitionFilesystem::ReplaceFileWithSubdirectory(VirtualFile file, VirtualD return false; 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_dirs.emplace_back(std::move(dir)); -- cgit v1.2.3