strv: make iterator in STRV_FOREACH() declaread in the loop

This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
This commit is contained in:
Yu Watanabe
2022-03-19 08:33:33 +09:00
parent 80a226b26b
commit de010b0b2e
210 changed files with 109 additions and 621 deletions
-4
View File
@@ -280,7 +280,6 @@ static int boot_entries_find(
size_t *n_entries) {
_cleanup_strv_free_ char **files = NULL;
char **f;
int r;
assert(root);
@@ -856,8 +855,6 @@ int boot_entries_augment_from_loader(
"auto-reboot-to-firmware-setup", "Reboot Into Firmware Interface",
};
char **i;
assert(config);
/* Let's add the entries discovered by the boot loader to the end of our list, unless they are
@@ -866,7 +863,6 @@ int boot_entries_augment_from_loader(
STRV_FOREACH(i, found_by_loader) {
BootEntry *existing;
_cleanup_free_ char *c = NULL, *t = NULL, *p = NULL;
char **a, **b;
existing = boot_config_find_entry(config, *i);
if (existing) {