From d36e327ba62fc853d75c413fd30ba38385dfa210 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 20 Jul 2018 22:23:56 -0400 Subject: [PATCH] partition_filesystem, vfs_real: Use std::move in ReplaceFileWithSubdirectory() where applicable Avoids unnecessary atomic increment and decrement operations. --- src/core/file_sys/partition_filesystem.cpp | 2 +- src/core/file_sys/vfs_real.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp index fc37a40cc..c523a605a 100644 --- a/src/core/file_sys/partition_filesystem.cpp +++ b/src/core/file_sys/partition_filesystem.cpp @@ -109,7 +109,7 @@ bool PartitionFilesystem::ReplaceFileWithSubdirectory(VirtualFile file, VirtualD pfs_files[offset] = pfs_files.back(); pfs_files.pop_back(); - pfs_dirs.emplace_back(dir); + pfs_dirs.emplace_back(std::move(dir)); return true; } diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index fa0df1bbe..305d44a93 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include "common/common_paths.h" #include "common/logging/log.h" @@ -173,7 +174,7 @@ bool RealVfsDirectory::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir files[offset] = files.back(); files.pop_back(); - subdirectories.emplace_back(dir); + subdirectories.emplace_back(std::move(dir)); return true; }