aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-19 23:59:17 +0100
committerMax Kellermann <max@duempel.org>2014-02-20 00:04:23 +0100
commit9e0ce23a03096a9a2e3ac2936ca64b8ea1fdd326 (patch)
tree18da64dc44908132caad4792dffb78e6bbab0e8c
parent04ba433ca631f0c3f51b067a6b55dc1046bd287e (diff)
downloadmpd-9e0ce23a03096a9a2e3ac2936ca64b8ea1fdd326.tar.gz
mpd-9e0ce23a03096a9a2e3ac2936ca64b8ea1fdd326.tar.xz
mpd-9e0ce23a03096a9a2e3ac2936ca64b8ea1fdd326.zip
test/run_{filter,output}: use config_find_block()
-rw-r--r--test/run_filter.cxx19
-rw-r--r--test/run_output.cxx19
2 files changed, 4 insertions, 34 deletions
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index c43144a10..1bde583a4 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -50,26 +50,11 @@ mixer_set_volume(gcc_unused Mixer *mixer,
return true;
}
-static const struct config_param *
-find_named_config_block(ConfigOption option, const char *name)
-{
- const struct config_param *param = NULL;
-
- while ((param = config_get_next_param(option, param)) != NULL) {
- const char *current_name = param->GetBlockValue("name");
- if (current_name != NULL && strcmp(current_name, name) == 0)
- return param;
- }
-
- return NULL;
-}
-
static Filter *
load_filter(const char *name)
{
- const struct config_param *param;
-
- param = find_named_config_block(CONF_AUDIO_FILTER, name);
+ const config_param *param =
+ config_find_block(CONF_AUDIO_FILTER, "name", name);
if (param == NULL) {
fprintf(stderr, "No such configured filter: %s\n", name);
return nullptr;
diff --git a/test/run_output.cxx b/test/run_output.cxx
index 8aac5e555..fca5146df 100644
--- a/test/run_output.cxx
+++ b/test/run_output.cxx
@@ -53,20 +53,6 @@ filter_plugin_by_name(gcc_unused const char *name)
return NULL;
}
-static const struct config_param *
-find_named_config_block(ConfigOption option, const char *name)
-{
- const struct config_param *param = NULL;
-
- while ((param = config_get_next_param(option, param)) != NULL) {
- const char *current_name = param->GetBlockValue("name");
- if (current_name != NULL && strcmp(current_name, name) == 0)
- return param;
- }
-
- return NULL;
-}
-
PlayerControl::PlayerControl(gcc_unused MultipleOutputs &_outputs,
gcc_unused unsigned _buffer_chunks,
gcc_unused unsigned _buffered_before_play)
@@ -76,9 +62,8 @@ PlayerControl::~PlayerControl() {}
static AudioOutput *
load_audio_output(EventLoop &event_loop, const char *name)
{
- const struct config_param *param;
-
- param = find_named_config_block(CONF_AUDIO_OUTPUT, name);
+ const config_param *param =
+ config_find_block(CONF_AUDIO_OUTPUT, "name", name);
if (param == NULL) {
fprintf(stderr, "No such configured audio output: %s\n", name);
return nullptr;