aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderList.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-21 22:14:08 +0200
committerMax Kellermann <max@duempel.org>2013-10-21 22:15:57 +0200
commitf6d67ac260ad12a6465378d93d03d98fea857ec8 (patch)
treeda2c164d8ff8ad609e6fb366c05f6623b9ccf1f8 /src/DecoderList.hxx
parent74904b9cf2fe163c0ae1d53fb73b19826b256812 (diff)
downloadmpd-f6d67ac260ad12a6465378d93d03d98fea857ec8.tar.gz
mpd-f6d67ac260ad12a6465378d93d03d98fea857ec8.tar.xz
mpd-f6d67ac260ad12a6465378d93d03d98fea857ec8.zip
DecoderThread: simplify the decoder lookup loop
Merge the two loops into one, and eliminate the GSList.
Diffstat (limited to '')
-rw-r--r--src/DecoderList.hxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/DecoderList.hxx b/src/DecoderList.hxx
index 51aeb1d71..fd4b22c63 100644
--- a/src/DecoderList.hxx
+++ b/src/DecoderList.hxx
@@ -62,6 +62,17 @@ decoder_plugins_find(F f)
}
template<typename F>
+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<typename F>
static inline void
decoder_plugins_for_each(F f)
{