Commit eeaec99c authored by Max Kellermann's avatar Max Kellermann

filter/LoadChain: use IterableSplitString()

parent b0002e3b
...@@ -21,12 +21,10 @@ ...@@ -21,12 +21,10 @@
#include "Factory.hxx" #include "Factory.hxx"
#include "Prepared.hxx" #include "Prepared.hxx"
#include "plugins/ChainFilterPlugin.hxx" #include "plugins/ChainFilterPlugin.hxx"
#include "util/IterableSplitString.hxx"
#include <algorithm>
#include <string> #include <string>
#include <string.h>
static void static void
filter_chain_append_new(PreparedFilter &chain, FilterFactory &factory, filter_chain_append_new(PreparedFilter &chain, FilterFactory &factory,
const char *template_name) const char *template_name)
...@@ -40,18 +38,11 @@ filter_chain_parse(PreparedFilter &chain, ...@@ -40,18 +38,11 @@ filter_chain_parse(PreparedFilter &chain,
FilterFactory &factory, FilterFactory &factory,
const char *spec) const char *spec)
{ {
const char *const end = spec + strlen(spec); for (const std::string_view i : IterableSplitString(spec, ',')) {
if (i.empty())
while (true) { continue;
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());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment