From eec4b705d506cb18dc9ae4757d782b7f618e4829 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 28 Mar 2017 15:59:08 -0400 Subject: [PATCH] MEGASignatureDB: Move objects where applicable Signatures during loading and strings during reference retrieval can be moved. --- Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp b/Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp index a4a1690556..45543cdfaf 100644 --- a/Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp +++ b/Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "Common/FileUtil.h" #include "Common/Logging/Log.h" @@ -91,7 +92,7 @@ bool GetRefs(MEGASignature* sig, std::istringstream* iss) WARN_LOG(OSHLE, "MEGA database failed to parse reference %u name", ref_count); return false; } - sig->refs.emplace_back(static_cast(offset), ref); + sig->refs.emplace_back(static_cast(offset), std::move(ref)); ref_count += 1; num.clear(); @@ -120,12 +121,13 @@ MEGASignatureDB::~MEGASignatureDB() = default; bool MEGASignatureDB::Load(const std::string& file_path) { - std::string line; std::ifstream ifs; OpenFStream(ifs, file_path, std::ios_base::in); if (!ifs) return false; + + std::string line; for (size_t i = 1; std::getline(ifs, line); ++i) { std::istringstream iss(line); @@ -133,7 +135,7 @@ bool MEGASignatureDB::Load(const std::string& file_path) if (GetCode(&sig, &iss) && GetName(&sig, &iss) && GetRefs(&sig, &iss)) { - m_signatures.push_back(sig); + m_signatures.push_back(std::move(sig)); } else {