Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e60141b4
Commit
e60141b4
authored
Jun 12, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input_registry: add _for_each() macros
parent
5b217420
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
input_init.c
src/input_init.c
+3
-4
input_registry.h
src/input_registry.h
+10
-0
input_stream.c
src/input_stream.c
+1
-5
No files found.
src/input_init.c
View file @
e60141b4
...
@@ -93,8 +93,7 @@ input_stream_global_init(GError **error_r)
...
@@ -93,8 +93,7 @@ input_stream_global_init(GError **error_r)
void
input_stream_global_finish
(
void
)
void
input_stream_global_finish
(
void
)
{
{
for
(
unsigned
i
=
0
;
input_plugins
[
i
]
!=
NULL
;
++
i
)
input_plugins_for_each_enabled
(
plugin
)
if
(
input_plugins_enabled
[
i
]
&&
if
(
plugin
->
finish
!=
NULL
)
input_plugins
[
i
]
->
finish
!=
NULL
)
plugin
->
finish
();
input_plugins
[
i
]
->
finish
();
}
}
src/input_registry.h
View file @
e60141b4
...
@@ -32,4 +32,14 @@ extern const struct input_plugin *const input_plugins[];
...
@@ -32,4 +32,14 @@ extern const struct input_plugin *const input_plugins[];
extern
bool
input_plugins_enabled
[];
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
#endif
src/input_stream.c
View file @
e60141b4
...
@@ -39,13 +39,9 @@ input_stream_open(const char *url, GError **error_r)
...
@@ -39,13 +39,9 @@ input_stream_open(const char *url, GError **error_r)
assert
(
error_r
==
NULL
||
*
error_r
==
NULL
);
assert
(
error_r
==
NULL
||
*
error_r
==
NULL
);
for
(
unsigned
i
=
0
;
input_plugins
[
i
]
!=
NULL
;
++
i
)
{
input_plugins_for_each_enabled
(
plugin
)
{
const
struct
input_plugin
*
plugin
=
input_plugins
[
i
];
struct
input_stream
*
is
;
struct
input_stream
*
is
;
if
(
!
input_plugins_enabled
[
i
])
continue
;
is
=
plugin
->
open
(
url
,
&
error
);
is
=
plugin
->
open
(
url
,
&
error
);
if
(
is
!=
NULL
)
{
if
(
is
!=
NULL
)
{
assert
(
is
->
plugin
!=
NULL
);
assert
(
is
->
plugin
!=
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment