From 99962b91e5ec7aab3a07a7e8aae982bc75541adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 28 Dec 2023 10:52:28 +0100 Subject: [PATCH] Minor code simplification (ToMap instead of section->GetKeys) See #18442 --- Core/Config.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index a60d1dbedf..1d97f59050 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1893,19 +1893,14 @@ void PlayTimeTracker::Stop(const std::string &gameId) { void PlayTimeTracker::Load(const Section *section) { tracker_.clear(); - std::vector keys; - section->GetKeys(keys); - - for (auto key : keys) { - std::string value; - if (!section->Get(key.c_str(), &value, nullptr)) { - continue; - } + auto map = section->ToMap(); + for (const auto &iter : map) { + const std::string &value = iter.second; // Parse the string. PlayTime gameTime{}; if (2 == sscanf(value.c_str(), "%d,%llu", &gameTime.totalTimePlayed, (long long *)&gameTime.lastTimePlayed)) { - tracker_[key] = gameTime; + tracker_[iter.first.c_str()] = gameTime; } } }