aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/deprecated-features.cc
diff options
context:
space:
mode:
authorpiegames <git@piegames.de>2024-08-18 14:43:12 +0200
committerpiegames <git@piegames.de>2024-08-18 16:56:49 +0000
commit007211e7a27a512cb343060e8b363c9f66ef67af (patch)
treef5d127d61e182049e2c1534d1ded45bc2ef265f3 /src/libutil/deprecated-features.cc
parent7506d680ac540f39944c2a9f573900c5b1e4a023 (diff)
libutil: Optimize feature checks
Instead of doing a linear search on an std::set, we use a bitset enum. Change-Id: Ide537f6cffdd16d06e59aaeb2e4ac0acb6493421
Diffstat (limited to 'src/libutil/deprecated-features.cc')
-rw-r--r--src/libutil/deprecated-features.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/deprecated-features.cc b/src/libutil/deprecated-features.cc
index 11b6c42bd..877d69da0 100644
--- a/src/libutil/deprecated-features.cc
+++ b/src/libutil/deprecated-features.cc
@@ -77,12 +77,12 @@ nlohmann::json documentDeprecatedFeatures()
return (nlohmann::json) res;
}
-std::set<DeprecatedFeature> parseDeprecatedFeatures(const std::set<std::string> & rawFeatures)
+DeprecatedFeatures parseDeprecatedFeatures(const std::set<std::string> & rawFeatures)
{
- std::set<DeprecatedFeature> res;
+ DeprecatedFeatures res{};
for (auto & rawFeature : rawFeatures)
if (auto feature = parseDeprecatedFeature(rawFeature))
- res.insert(*feature);
+ res = res | *feature;
return res;
}