aboutsummaryrefslogtreecommitdiffstats
path: root/src/input_stream.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-14 22:43:00 +0100
committerMax Kellermann <max@duempel.org>2009-12-14 22:43:00 +0100
commitf7420dbfe126bdc0f264c79a112cb205eba86f48 (patch)
tree2c4860943f269de752c10f1d42425127ccae287d /src/input_stream.c
parent400600ffffe64b85e7be14c978c2d0803a34097d (diff)
downloadmpd-f7420dbfe126bdc0f264c79a112cb205eba86f48.tar.gz
mpd-f7420dbfe126bdc0f264c79a112cb205eba86f48.tar.xz
mpd-f7420dbfe126bdc0f264c79a112cb205eba86f48.zip
input_stream: make input_plugins NULL terminated
This is easier to traverse.
Diffstat (limited to 'src/input_stream.c')
-rw-r--r--src/input_stream.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/input_stream.c b/src/input_stream.c
index 0174b5a2e..749d51623 100644
--- a/src/input_stream.c
+++ b/src/input_stream.c
@@ -50,12 +50,10 @@ static const struct input_plugin *const input_plugins[] = {
#ifdef ENABLE_MMS
&input_plugin_mms,
#endif
+ NULL
};
-static bool input_plugins_enabled[G_N_ELEMENTS(input_plugins)];
-
-static const unsigned num_input_plugins =
- sizeof(input_plugins) / sizeof(input_plugins[0]);
+static bool input_plugins_enabled[G_N_ELEMENTS(input_plugins) - 1];
/**
* Find the "input" configuration block for the specified plugin.
@@ -84,7 +82,7 @@ input_plugin_config(const char *plugin_name)
void input_stream_global_init(void)
{
- for (unsigned i = 0; i < num_input_plugins; ++i) {
+ for (unsigned i = 0; input_plugins[i] != NULL; ++i) {
const struct input_plugin *plugin = input_plugins[i];
const struct config_param *param =
input_plugin_config(plugin->name);
@@ -100,7 +98,7 @@ void input_stream_global_init(void)
void input_stream_global_finish(void)
{
- for (unsigned i = 0; i < num_input_plugins; ++i)
+ for (unsigned i = 0; input_plugins[i] != NULL; ++i)
if (input_plugins_enabled[i] &&
input_plugins[i]->finish != NULL)
input_plugins[i]->finish();
@@ -116,7 +114,7 @@ input_stream_open(struct input_stream *is, const char *url)
is->error = 0;
is->mime = NULL;
- for (unsigned i = 0; i < num_input_plugins; ++i) {
+ for (unsigned i = 0; input_plugins[i] != NULL; ++i) {
const struct input_plugin *plugin = input_plugins[i];
if (input_plugins_enabled[i] && plugin->open(is, url)) {