1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

bootspec: don't needlessly inline boot_config_find_entry()

the function contains a loop and if expressions and whatnot. Let's
define it as regular function, to make the header easier to read and let
the compiler more freedom on whether to inline this or not.
This commit is contained in:
Lennart Poettering 2022-03-24 17:08:09 +01:00
parent d412691a91
commit 3f8e42c038
2 changed files with 13 additions and 11 deletions

View File

@ -986,3 +986,15 @@ int boot_entries_augment_from_loader(
return 0;
}
BootEntry* boot_config_find_entry(BootConfig *config, const char *id) {
assert(config);
assert(id);
for (size_t j = 0; j < config->n_entries; j++)
if (streq_ptr(config->entries[j].id, id) ||
streq_ptr(config->entries[j].id_old, id))
return config->entries + j;
return NULL;
}

View File

@ -69,17 +69,7 @@ typedef struct BootConfig {
.selected_entry = -1, \
}
static inline BootEntry* boot_config_find_entry(BootConfig *config, const char *id) {
assert(config);
assert(id);
for (size_t j = 0; j < config->n_entries; j++)
if (streq_ptr(config->entries[j].id, id) ||
streq_ptr(config->entries[j].id_old, id))
return config->entries + j;
return NULL;
}
BootEntry* boot_config_find_entry(BootConfig *config, const char *id);
static inline BootEntry* boot_config_default_entry(BootConfig *config) {
assert(config);