1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

udev-builtin: use FOREACH_ELEMENT() macro

This commit is contained in:
Yu Watanabe 2024-12-04 04:49:42 +09:00
parent 130698dc20
commit 975115321f

View File

@ -36,9 +36,9 @@ void udev_builtin_init(void) {
if (initialized)
return;
for (UdevBuiltinCommand i = 0; i < _UDEV_BUILTIN_MAX; i++)
if (builtins[i] && builtins[i]->init)
builtins[i]->init();
FOREACH_ELEMENT(b, builtins)
if (*b && (*b)->init)
(*b)->init();
initialized = true;
}
@ -47,9 +47,9 @@ void udev_builtin_exit(void) {
if (!initialized)
return;
for (UdevBuiltinCommand i = 0; i < _UDEV_BUILTIN_MAX; i++)
if (builtins[i] && builtins[i]->exit)
builtins[i]->exit();
FOREACH_ELEMENT(b, builtins)
if (*b && (*b)->exit)
(*b)->exit();
initialized = false;
}
@ -62,9 +62,9 @@ bool udev_builtin_should_reload(void) {
}
void udev_builtin_list(void) {
for (UdevBuiltinCommand i = 0; i < _UDEV_BUILTIN_MAX; i++)
if (builtins[i])
fprintf(stderr, " %-14s %s\n", builtins[i]->name, builtins[i]->help);
FOREACH_ELEMENT(b, builtins)
if (*b)
fprintf(stderr, " %-14s %s\n", (*b)->name, (*b)->help);
}
const char* udev_builtin_name(UdevBuiltinCommand cmd) {