From f7420dbfe126bdc0f264c79a112cb205eba86f48 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 14 Dec 2009 22:43:00 +0100 Subject: input_stream: make input_plugins NULL terminated This is easier to traverse. --- src/input_stream.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') 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)) { -- cgit v1.2.3