diff options
author | Max Kellermann <max@duempel.org> | 2012-06-12 22:21:48 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-06-12 22:21:48 +0200 |
commit | e60141b4dd726d78f3c33bb02e53d1c0f9e670a5 (patch) | |
tree | 31081beb348f8d701223158c4f5e9e37126d053a /src/input_registry.h | |
parent | 5b217420954ad1962b822faa1e2881570f803992 (diff) | |
download | mpd-e60141b4dd726d78f3c33bb02e53d1c0f9e670a5.tar.gz mpd-e60141b4dd726d78f3c33bb02e53d1c0f9e670a5.tar.xz mpd-e60141b4dd726d78f3c33bb02e53d1c0f9e670a5.zip |
input_registry: add _for_each() macros
Diffstat (limited to 'src/input_registry.h')
-rw-r--r-- | src/input_registry.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/input_registry.h b/src/input_registry.h index e85d6be8e..c57b8296c 100644 --- a/src/input_registry.h +++ b/src/input_registry.h @@ -32,4 +32,14 @@ extern const struct input_plugin *const input_plugins[]; extern bool input_plugins_enabled[]; +#define input_plugins_for_each(plugin) \ + for (const struct input_plugin *plugin, \ + *const*input_plugin_iterator = &input_plugins[0]; \ + (plugin = *input_plugin_iterator) != NULL; \ + ++input_plugin_iterator) + +#define input_plugins_for_each_enabled(plugin) \ + input_plugins_for_each(plugin) \ + if (input_plugins_enabled[input_plugin_iterator - input_plugins]) + #endif |