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
edbfa46c
Commit
edbfa46c
authored
Jun 12, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encoder_list: add macro _for_each()
parent
90709a6d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
encoder_list.c
src/encoder_list.c
+6
-6
encoder_list.h
src/encoder_list.h
+8
-0
No files found.
src/encoder_list.c
View file @
edbfa46c
...
...
@@ -30,7 +30,7 @@ extern const struct encoder_plugin twolame_encoder_plugin;
extern
const
struct
encoder_plugin
wave_encoder_plugin
;
extern
const
struct
encoder_plugin
flac_encoder_plugin
;
static
const
struct
encoder_plugin
*
const
encoder_plugins
[]
=
{
const
struct
encoder_plugin
*
const
encoder_plugins
[]
=
{
&
null_encoder_plugin
,
#ifdef ENABLE_VORBIS_ENCODER
&
vorbis_encoder_plugin
,
...
...
@@ -53,9 +53,9 @@ static const struct encoder_plugin *const encoder_plugins[] = {
const
struct
encoder_plugin
*
encoder_plugin_get
(
const
char
*
name
)
{
for
(
unsigned
i
=
0
;
encoder_plugins
[
i
]
!=
NULL
;
++
i
)
if
(
strcmp
(
encoder_plugins
[
i
]
->
name
,
name
)
==
0
)
return
encoder_plugins
[
i
]
;
encoder_plugins_for_each
(
plugin
)
if
(
strcmp
(
plugin
->
name
,
name
)
==
0
)
return
plugin
;
return
NULL
;
}
...
...
@@ -63,8 +63,8 @@ encoder_plugin_get(const char *name)
void
encoder_plugin_print_all_types
(
FILE
*
fp
)
{
for
(
unsigned
i
=
0
;
encoder_plugins
[
i
]
!=
NULL
;
++
i
)
fprintf
(
fp
,
"%s "
,
encoder_plugins
[
i
]
->
name
);
encoder_plugins_for_each
(
plugin
)
fprintf
(
fp
,
"%s "
,
plugin
->
name
);
fprintf
(
fp
,
"
\n
"
);
fflush
(
fp
);
...
...
src/encoder_list.h
View file @
edbfa46c
...
...
@@ -24,6 +24,14 @@
struct
encoder_plugin
;
extern
const
struct
encoder_plugin
*
const
encoder_plugins
[];
#define encoder_plugins_for_each(plugin) \
for (const struct encoder_plugin *plugin, \
*const*encoder_plugin_iterator = &encoder_plugins[0]; \
(plugin = *encoder_plugin_iterator) != NULL; \
++encoder_plugin_iterator)
/**
* Looks up an encoder plugin by its name.
*
...
...
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