From ec31664c52d22d2a18dbedcd079aa2c040920874 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 2 Apr 2023 19:46:02 +0200 Subject: [PATCH] Small cleanup --- src/common/utils/info_string.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/utils/info_string.cpp b/src/common/utils/info_string.cpp index cd3d6637..b2ad05c5 100644 --- a/src/common/utils/info_string.cpp +++ b/src/common/utils/info_string.cpp @@ -42,25 +42,25 @@ namespace utils buffer = buffer.substr(1); } - auto key_values = string::split(buffer, '\\'); + const auto key_values = string::split(buffer, '\\'); for (size_t i = 0; !key_values.empty() && i < (key_values.size() - 1); i += 2) { const auto& key = key_values[i]; const auto& value = key_values[i + 1]; - this->key_value_pairs_[key] = value; + + if (!this->key_value_pairs_.contains(key)) + { + this->key_value_pairs_[key] = value; + } } } std::string info_string::build() const { - //auto first = true; std::string info_string; for (auto i = this->key_value_pairs_.begin(); i != this->key_value_pairs_.end(); ++i) { - //if (first) first = false; - /*else*/ info_string.append("\\"); - info_string.append(i->first); // Key info_string.append("\\"); info_string.append(i->second); // Value