From f6d67ac260ad12a6465378d93d03d98fea857ec8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 21 Oct 2013 22:14:08 +0200 Subject: DecoderThread: simplify the decoder lookup loop Merge the two loops into one, and eliminate the GSList. --- src/DecoderList.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/DecoderList.hxx') diff --git a/src/DecoderList.hxx b/src/DecoderList.hxx index 51aeb1d71..fd4b22c63 100644 --- a/src/DecoderList.hxx +++ b/src/DecoderList.hxx @@ -61,6 +61,17 @@ decoder_plugins_find(F f) return nullptr; } +template +static inline bool +decoder_plugins_try(F f) +{ + for (unsigned i = 0; decoder_plugins[i] != nullptr; ++i) + if (decoder_plugins_enabled[i] && f(*decoder_plugins[i])) + return true; + + return false; +} + template static inline void decoder_plugins_for_each(F f) -- cgit v1.2.3