From 3f8e42c03828ff2da0392111b394fac6f5d3c3da Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 24 Mar 2022 17:08:09 +0100 Subject: [PATCH] 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. --- src/shared/bootspec.c | 12 ++++++++++++ src/shared/bootspec.h | 12 +----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 188ab1d6635..fd08e22bf9b 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -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; +} diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h index 0f199d5ee90..02ccd90aee7 100644 --- a/src/shared/bootspec.h +++ b/src/shared/bootspec.h @@ -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);