diff options
author | Max Kellermann <max@musicpd.org> | 2020-11-04 16:32:54 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-11-04 16:36:11 +0100 |
commit | eeaec99c596b1bc8b5dbadbb27b82bf50fd981c7 (patch) | |
tree | d3f461a1102b00a2b1e7e787df5badb13bf60128 /src/filter | |
parent | b0002e3b73e2d09a9eb0d815f86342dc96918ef5 (diff) |
filter/LoadChain: use IterableSplitString()
Diffstat (limited to 'src/filter')
-rw-r--r-- | src/filter/LoadChain.cxx | 21 |
1 files changed, 6 insertions, 15 deletions
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 <algorithm> #include <string> -#include <string.h> - 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); - - 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; + for (const std::string_view i : IterableSplitString(spec, ',')) { + if (i.empty()) + continue; - spec = comma + 1; + const std::string name(i); + filter_chain_append_new(chain, factory, name.c_str()); } } |