Fix warnings and co (#3507)

This commit is contained in:
Hind-M 2024-10-04 14:41:50 +02:00 committed by GitHub
parent 675c6de0e6
commit 80c8b184d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -520,9 +520,11 @@ namespace mamba::specs
// TODO: this solution reallocates memory several times potentially, but the // TODO: this solution reallocates memory several times potentially, but the
// number of operators is small and the strings are short, so it must be fine. // number of operators is small and the strings are short, so it must be fine.
// If needed it can be optimized so that the string is only copied once. // If needed it can be optimized so that the string is only copied once.
for (const std::string& op : { ">=", "<=", "==", ">", "<", "!=", "=", "==", "~=", "," }) const auto op_array = std::array<std::string, 9>{ ">=", "<=", ">", "<", "!=",
"=", "==", "~=", "," };
for (const std::string& op : op_array)
{ {
const std::string& bad_op = op + " "; const std::string bad_op = op + " ";
while (raw_match_spec_str.find(bad_op) != std::string::npos) while (raw_match_spec_str.find(bad_op) != std::string::npos)
{ {
raw_match_spec_str = raw_match_spec_str.substr(0, raw_match_spec_str.find(bad_op)) + op raw_match_spec_str = raw_match_spec_str.substr(0, raw_match_spec_str.find(bad_op)) + op
@ -604,7 +606,7 @@ namespace mamba::specs
{ {
if (is_hash(hash)) if (is_hash(hash))
{ {
ms.set_md5(std::string(hash)); ms.set_md5(hash);
} }
return ms; return ms;
} }