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
f1ecd9ea
Commit
f1ecd9ea
authored
Dec 15, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive_list: iterate with NULL check
Don't use num_archive_plugins.
parent
243c9630
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
archive_list.c
src/archive_list.c
+6
-12
No files found.
src/archive_list.c
View file @
f1ecd9ea
...
...
@@ -42,22 +42,16 @@ static const struct archive_plugin *const archive_plugins[] = {
NULL
};
enum
{
num_archive_plugins
=
G_N_ELEMENTS
(
archive_plugins
)
-
1
,
};
/** which plugins have been initialized successfully? */
static
bool
archive_plugins_enabled
[
num_archive_plugins
+
1
];
static
bool
archive_plugins_enabled
[
G_N_ELEMENTS
(
archive_plugins
)
-
1
];
const
struct
archive_plugin
*
archive_plugin_from_suffix
(
const
char
*
suffix
)
{
unsigned
i
;
if
(
suffix
==
NULL
)
return
NULL
;
for
(
i
=
0
;
i
<
num_archive_plugins
;
++
i
)
{
for
(
unsigned
i
=
0
;
archive_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
archive_plugin
*
plugin
=
archive_plugins
[
i
];
if
(
archive_plugins_enabled
[
i
]
&&
plugin
->
suffixes
!=
NULL
&&
...
...
@@ -72,7 +66,7 @@ archive_plugin_from_suffix(const char *suffix)
const
struct
archive_plugin
*
archive_plugin_from_name
(
const
char
*
name
)
{
for
(
unsigned
i
=
0
;
i
<
num_archive_plugins
;
++
i
)
{
for
(
unsigned
i
=
0
;
archive_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
archive_plugin
*
plugin
=
archive_plugins
[
i
];
if
(
archive_plugins_enabled
[
i
]
&&
strcmp
(
plugin
->
name
,
name
)
==
0
)
...
...
@@ -85,7 +79,7 @@ void archive_plugin_print_all_suffixes(FILE * fp)
{
const
char
*
const
*
suffixes
;
for
(
unsigned
i
=
0
;
i
<
num_archive_plugins
;
++
i
)
{
for
(
unsigned
i
=
0
;
archive_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
archive_plugin
*
plugin
=
archive_plugins
[
i
];
if
(
!
archive_plugins_enabled
[
i
])
continue
;
...
...
@@ -102,7 +96,7 @@ void archive_plugin_print_all_suffixes(FILE * fp)
void
archive_plugin_init_all
(
void
)
{
for
(
unsigned
i
=
0
;
i
<
num_archive_plugins
;
++
i
)
{
for
(
unsigned
i
=
0
;
archive_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
archive_plugin
*
plugin
=
archive_plugins
[
i
];
if
(
plugin
->
init
==
NULL
||
archive_plugins
[
i
]
->
init
())
archive_plugins_enabled
[
i
]
=
true
;
...
...
@@ -111,7 +105,7 @@ void archive_plugin_init_all(void)
void
archive_plugin_deinit_all
(
void
)
{
for
(
unsigned
i
=
0
;
i
<
num_archive_plugins
;
++
i
)
{
for
(
unsigned
i
=
0
;
archive_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
archive_plugin
*
plugin
=
archive_plugins
[
i
];
if
(
archive_plugins_enabled
[
i
]
&&
plugin
->
finish
!=
NULL
)
archive_plugins
[
i
]
->
finish
();
...
...
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