Commit 03cddd0a authored by Max Kellermann's avatar Max Kellermann

FilterConfig: return bool

parent 04a737e0
...@@ -86,15 +86,12 @@ filter_chain_append_new(Filter &chain, const char *template_name, Error &error) ...@@ -86,15 +86,12 @@ filter_chain_append_new(Filter &chain, const char *template_name, Error &error)
return true; return true;
} }
unsigned int bool
filter_chain_parse(Filter &chain, const char *spec, Error &error) filter_chain_parse(Filter &chain, const char *spec, Error &error)
{ {
// Split on comma // Split on comma
gchar** tokens = g_strsplit_set(spec, ",", 255); gchar** tokens = g_strsplit_set(spec, ",", 255);
unsigned added_filters = 0;
// Add each name to the filter chain by instantiating an actual filter // Add each name to the filter chain by instantiating an actual filter
char **template_names = tokens; char **template_names = tokens;
while (*template_names != NULL) { while (*template_names != NULL) {
...@@ -102,14 +99,12 @@ filter_chain_parse(Filter &chain, const char *spec, Error &error) ...@@ -102,14 +99,12 @@ filter_chain_parse(Filter &chain, const char *spec, Error &error)
g_strstrip(*template_names); g_strstrip(*template_names);
if (!filter_chain_append_new(chain, *template_names, error)) if (!filter_chain_append_new(chain, *template_names, error))
break; return false;
++added_filters;
++template_names; ++template_names;
} }
g_strfreev(tokens); g_strfreev(tokens);
return added_filters; return true;
} }
...@@ -35,9 +35,9 @@ class Error; ...@@ -35,9 +35,9 @@ class Error;
* @param chain the chain to append filters on * @param chain the chain to append filters on
* @param spec the filter chain specification * @param spec the filter chain specification
* @param error_r space to return an error description * @param error_r space to return an error description
* @return the number of filters which were successfully added * @return true on success
*/ */
unsigned int bool
filter_chain_parse(Filter &chain, const char *spec, Error &error); filter_chain_parse(Filter &chain, const char *spec, Error &error);
#endif #endif
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