aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_list.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-06-12 21:09:40 +0200
committerMax Kellermann <max@duempel.org>2012-06-12 21:15:46 +0200
commitd2d9b45a8189b7771e1b7dfbe7d5a550fcf400b8 (patch)
tree6e1653ab8cd563dd2e6c326d99fecda34d202fe6 /src/decoder_list.h
parent9ebbdb9b0b288164ce956ba34bc0c38f94868110 (diff)
downloadmpd-d2d9b45a8189b7771e1b7dfbe7d5a550fcf400b8.tar.gz
mpd-d2d9b45a8189b7771e1b7dfbe7d5a550fcf400b8.tar.xz
mpd-d2d9b45a8189b7771e1b7dfbe7d5a550fcf400b8.zip
decoder_list: add _for_each() macros
Diffstat (limited to 'src/decoder_list.h')
-rw-r--r--src/decoder_list.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/decoder_list.h b/src/decoder_list.h
index 7041db0c9..0fb63d401 100644
--- a/src/decoder_list.h
+++ b/src/decoder_list.h
@@ -27,6 +27,16 @@ struct decoder_plugin;
extern const struct decoder_plugin *const decoder_plugins[];
extern bool decoder_plugins_enabled[];
+#define decoder_plugins_for_each(plugin) \
+ for (const struct decoder_plugin *plugin, \
+ *const*decoder_plugin_iterator = &decoder_plugins[0]; \
+ (plugin = *decoder_plugin_iterator) != NULL; \
+ ++decoder_plugin_iterator)
+
+#define decoder_plugins_for_each_enabled(plugin) \
+ decoder_plugins_for_each(plugin) \
+ if (decoder_plugins_enabled[decoder_plugin_iterator - decoder_plugins])
+
/* interface for using plugins */
/**