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
d2d9b45a
Commit
d2d9b45a
authored
Jun 12, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_list: add _for_each() macros
parent
9ebbdb9b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
16 deletions
+17
-16
cmdline.c
src/cmdline.c
+1
-2
decoder_list.c
src/decoder_list.c
+4
-11
decoder_list.h
src/decoder_list.h
+10
-0
decoder_print.c
src/decoder_print.c
+2
-3
No files found.
src/cmdline.c
View file @
d2d9b45a
...
...
@@ -58,8 +58,7 @@ cmdline_quark(void)
static
void
print_all_decoders
(
FILE
*
fp
)
{
for
(
unsigned
i
=
0
;
decoder_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
decoder_plugin
*
plugin
=
decoder_plugins
[
i
];
decoder_plugins_for_each
(
plugin
)
{
const
char
*
const
*
suffixes
;
fprintf
(
fp
,
"[%s]"
,
plugin
->
name
);
...
...
src/decoder_list.c
View file @
d2d9b45a
...
...
@@ -174,12 +174,9 @@ decoder_plugin_from_mime_type(const char *mimeType, unsigned int next)
const
struct
decoder_plugin
*
decoder_plugin_from_name
(
const
char
*
name
)
{
for
(
unsigned
i
=
0
;
decoder_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
decoder_plugin
*
plugin
=
decoder_plugins
[
i
];
if
(
decoder_plugins_enabled
[
i
]
&&
strcmp
(
plugin
->
name
,
name
)
==
0
)
decoder_plugins_for_each_enabled
(
plugin
)
if
(
strcmp
(
plugin
->
name
,
name
)
==
0
)
return
plugin
;
}
return
NULL
;
}
...
...
@@ -227,10 +224,6 @@ void decoder_plugin_init_all(void)
void
decoder_plugin_deinit_all
(
void
)
{
for
(
unsigned
i
=
0
;
decoder_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
decoder_plugin
*
plugin
=
decoder_plugins
[
i
];
if
(
decoder_plugins_enabled
[
i
])
decoder_plugin_finish
(
plugin
);
}
decoder_plugins_for_each_enabled
(
plugin
)
decoder_plugin_finish
(
plugin
);
}
src/decoder_list.h
View file @
d2d9b45a
...
...
@@ -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 */
/**
...
...
src/decoder_print.c
View file @
d2d9b45a
...
...
@@ -48,7 +48,6 @@ decoder_plugin_print(struct client *client,
void
decoder_list_print
(
struct
client
*
client
)
{
for
(
unsigned
i
=
0
;
decoder_plugins
[
i
]
!=
NULL
;
++
i
)
if
(
decoder_plugins_enabled
[
i
])
decoder_plugin_print
(
client
,
decoder_plugins
[
i
]);
decoder_plugins_for_each_enabled
(
plugin
)
decoder_plugin_print
(
client
,
plugin
);
}
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