From d23884e8e70cb5825fef47bd1aa23563aae5095a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 10 Feb 2024 20:27:14 +0000 Subject: [PATCH] use cvarlist for ws rules --- src/config/ConfigManager.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 9b9a95d2..3a695cd0 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2148,18 +2148,12 @@ std::optional CConfigManager::handleWorkspaceRules(const std::strin return {}; }; - size_t pos = 0; - std::string rule = rules; - while ((pos = rules.find(',')) != std::string::npos) { - rule = rules.substr(0, pos); - const auto R = assignRule(rule); + CVarList rulesList{rules, 0, ',', true}; + for (auto& r : rulesList) { + const auto R = assignRule(r); if (R.has_value()) return R; - rules.erase(0, pos + 1); } - const auto R = assignRule(rule); // match remaining rule - if (R.has_value()) - return R; wsRule.workspaceId = id; wsRule.workspaceName = name;