diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-24 04:59:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-24 04:59:20 +0200 |
commit | 4cc8ab8a86df21fefe312ccb4451b2643af32151 (patch) | |
tree | 5a1c80bc699a8b7ea00874e3244566bb6d85d1f7 | |
parent | Merge pull request #6229 from lioncash/unused-var (diff) | |
parent | lm: Make use of insert_or_assign() in Log() (diff) | |
download | yuzu-4cc8ab8a86df21fefe312ccb4451b2643af32151.tar yuzu-4cc8ab8a86df21fefe312ccb4451b2643af32151.tar.gz yuzu-4cc8ab8a86df21fefe312ccb4451b2643af32151.tar.bz2 yuzu-4cc8ab8a86df21fefe312ccb4451b2643af32151.tar.lz yuzu-4cc8ab8a86df21fefe312ccb4451b2643af32151.tar.xz yuzu-4cc8ab8a86df21fefe312ccb4451b2643af32151.tar.zst yuzu-4cc8ab8a86df21fefe312ccb4451b2643af32151.zip |
-rw-r--r-- | src/core/hle/service/lm/lm.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 7d7542fc2..9bcf8870d 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -46,7 +46,7 @@ struct hash<Service::LM::LogPacketHeaderEntry> { boost::hash_combine(seed, k.severity); boost::hash_combine(seed, k.verbosity); return seed; - }; + } }; } // namespace std @@ -95,7 +95,7 @@ private: std::memcpy(&header, data.data(), sizeof(LogPacketHeader)); offset += sizeof(LogPacketHeader); - LogPacketHeaderEntry entry{ + const LogPacketHeaderEntry entry{ .pid = header.pid, .tid = header.tid, .severity = header.severity, @@ -105,16 +105,17 @@ private: if (True(header.flags & LogPacketFlags::Head)) { std::vector<u8> 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); + // Append to existing entry - if (!entries.contains(entry)) { + if (entry_iter == entries.cend()) { LOG_ERROR(Service_LM, "Log entry does not exist!"); return; } - std::vector<u8> tmp(data.size() - sizeof(LogPacketHeader)); - auto& existing_entry = entries[entry]; + auto& existing_entry = entry_iter->second; const auto base = existing_entry.size(); existing_entry.resize(base + (data.size() - sizeof(LogPacketHeader))); std::memcpy(existing_entry.data() + base, data.data() + offset, |