From 29cd40bded0ee7885fdef9f0a2fbb4e6ad297561 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 23 Apr 2021 09:27:15 -0400 Subject: [PATCH] lm: Make use of insert_or_assign() in Log() Avoids unnecessary default construction of an entry in cases where no entry exists before overwriting the created entry. --- src/core/hle/service/lm/lm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index b311ad300..9bcf8870d 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -105,7 +105,7 @@ private: if (True(header.flags & LogPacketFlags::Head)) { std::vector tmp(data.size() - sizeof(LogPacketHeader)); std::memcpy(tmp.data(), data.data() + offset, tmp.size()); - entries[entry] = std::move(tmp); + entries.insert_or_assign(entry, std::move(tmp)); } else { const auto entry_iter = entries.find(entry);