input_stream: make input_plugins NULL terminated

This is easier to traverse.
This commit is contained in:
Max Kellermann 2009-12-14 22:43:00 +01:00
parent 400600ffff
commit f7420dbfe1

View File

@ -50,12 +50,10 @@ static const struct input_plugin *const input_plugins[] = {
#ifdef ENABLE_MMS #ifdef ENABLE_MMS
&input_plugin_mms, &input_plugin_mms,
#endif #endif
NULL
}; };
static bool input_plugins_enabled[G_N_ELEMENTS(input_plugins)]; static bool input_plugins_enabled[G_N_ELEMENTS(input_plugins) - 1];
static const unsigned num_input_plugins =
sizeof(input_plugins) / sizeof(input_plugins[0]);
/** /**
* Find the "input" configuration block for the specified plugin. * 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) 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 input_plugin *plugin = input_plugins[i];
const struct config_param *param = const struct config_param *param =
input_plugin_config(plugin->name); input_plugin_config(plugin->name);
@ -100,7 +98,7 @@ void input_stream_global_init(void)
void input_stream_global_finish(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] && if (input_plugins_enabled[i] &&
input_plugins[i]->finish != NULL) input_plugins[i]->finish != NULL)
input_plugins[i]->finish(); input_plugins[i]->finish();
@ -116,7 +114,7 @@ input_stream_open(struct input_stream *is, const char *url)
is->error = 0; is->error = 0;
is->mime = NULL; 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]; const struct input_plugin *plugin = input_plugins[i];
if (input_plugins_enabled[i] && plugin->open(is, url)) { if (input_plugins_enabled[i] && plugin->open(is, url)) {