ips_layer: std::move data within PatchIPS() and Apply()

We don't need to make a copy of the read data, so we can std::move it
into the make_shared call here.
This commit is contained in:
Lioncash 2018-10-09 13:34:38 -04:00
parent 561d79e034
commit 93ac8d0fea
1 changed files with 5 additions and 2 deletions

View File

@ -90,7 +90,9 @@ VirtualFile PatchIPS(const VirtualFile& in, const VirtualFile& ips) {
if (temp != std::vector<u8>{'E', 'E', 'O', 'F'} && temp != std::vector<u8>{'E', 'O', 'F'}) if (temp != std::vector<u8>{'E', 'E', 'O', 'F'} && temp != std::vector<u8>{'E', 'O', 'F'})
return nullptr; return nullptr;
return std::make_shared<VectorVfsFile>(in_data, in->GetName(), in->GetContainingDirectory());
return std::make_shared<VectorVfsFile>(std::move(in_data), in->GetName(),
in->GetContainingDirectory());
} }
IPSwitchCompiler::IPSwitchCompiler(VirtualFile patch_text_) : patch_text(std::move(patch_text_)) { IPSwitchCompiler::IPSwitchCompiler(VirtualFile patch_text_) : patch_text(std::move(patch_text_)) {
@ -291,7 +293,8 @@ VirtualFile IPSwitchCompiler::Apply(const VirtualFile& in) const {
} }
} }
return std::make_shared<VectorVfsFile>(in_data, in->GetName(), in->GetContainingDirectory()); return std::make_shared<VectorVfsFile>(std::move(in_data), in->GetName(),
in->GetContainingDirectory());
} }
} // namespace FileSys } // namespace FileSys