diff --git a/src/filter/LoadChain.cxx b/src/filter/LoadChain.cxx index 26e6f883a..b24abc8f8 100644 --- a/src/filter/LoadChain.cxx +++ b/src/filter/LoadChain.cxx @@ -21,12 +21,10 @@ #include "Factory.hxx" #include "Prepared.hxx" #include "plugins/ChainFilterPlugin.hxx" +#include "util/IterableSplitString.hxx" -#include #include -#include - static void filter_chain_append_new(PreparedFilter &chain, FilterFactory &factory, const char *template_name) @@ -40,18 +38,11 @@ filter_chain_parse(PreparedFilter &chain, FilterFactory &factory, const char *spec) { - const char *const end = spec + strlen(spec); + for (const std::string_view i : IterableSplitString(spec, ',')) { + if (i.empty()) + continue; - while (true) { - const char *comma = std::find(spec, end, ','); - if (comma > spec) { - const std::string name(spec, comma); - filter_chain_append_new(chain, factory, name.c_str()); - } - - if (comma == end) - break; - - spec = comma + 1; + const std::string name(i); + filter_chain_append_new(chain, factory, name.c_str()); } }