Commit d3f28a1d authored by Max Kellermann's avatar Max Kellermann

FilterConfig: use std::find instead of g_strsplit_set()

parent 03cddd0a
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "ConfigError.hxx" #include "ConfigError.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include <glib.h> #include <algorithm>
#include <string.h> #include <string.h>
...@@ -89,22 +89,22 @@ filter_chain_append_new(Filter &chain, const char *template_name, Error &error) ...@@ -89,22 +89,22 @@ filter_chain_append_new(Filter &chain, const char *template_name, Error &error)
bool bool
filter_chain_parse(Filter &chain, const char *spec, Error &error) filter_chain_parse(Filter &chain, const char *spec, Error &error)
{ {
// Split on comma const char *const end = spec + strlen(spec);
gchar** tokens = g_strsplit_set(spec, ",", 255);
while (true) {
// Add each name to the filter chain by instantiating an actual filter const char *comma = std::find(spec, end, ',');
char **template_names = tokens; if (comma > spec) {
while (*template_names != NULL) { const std::string name(spec, comma);
// Squeeze whitespace if (!filter_chain_append_new(chain, name.c_str(),
g_strstrip(*template_names); error))
return false;
}
if (!filter_chain_append_new(chain, *template_names, error)) if (comma == end)
return false; break;
++template_names; spec = comma + 1;
} }
g_strfreev(tokens);
return true; return true;
} }
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