From 5d55b45654eacd479a93673f9ec9ad3627952a96 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 7 Nov 2009 15:14:16 +0100 Subject: decoder_list: pass previous plugin pointer to lookup functions Remove the static integer hack, that's not thread safe and sucks. --- src/decoder_thread.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/decoder_thread.c') diff --git a/src/decoder_thread.c b/src/decoder_thread.c index e39c7f98e..1e850a037 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -118,13 +118,12 @@ decoder_run_stream_suffix(struct decoder *decoder, struct input_stream *is, const char *uri) { const char *suffix = uri_get_suffix(uri); - const struct decoder_plugin *plugin; - unsigned int next = 0; + const struct decoder_plugin *plugin = NULL; if (suffix == NULL) return false; - while ((plugin = decoder_plugin_from_suffix(suffix, next++))) + while ((plugin = decoder_plugin_from_suffix(suffix, plugin)) != NULL) if (plugin->stream_decode != NULL && decoder_stream_decode(plugin, decoder, is)) return true; @@ -212,15 +211,14 @@ static bool decoder_run_file(struct decoder *decoder, const char *path_fs) { const char *suffix = uri_get_suffix(path_fs); - const struct decoder_plugin *plugin; - unsigned int next = 0; + const struct decoder_plugin *plugin = NULL; if (suffix == NULL) return false; decoder_unlock(decoder->dc); - while ((plugin = decoder_plugin_from_suffix(suffix, next++))) { + while ((plugin = decoder_plugin_from_suffix(suffix, plugin)) != NULL) { if (plugin->file_decode != NULL) { decoder_lock(decoder->dc); -- cgit v1.2.3