]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootspec: don't needlessly inline boot_config_find_entry()
authorLennart Poettering <lennart@poettering.net>
Thu, 24 Mar 2022 16:08:09 +0000 (17:08 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 28 Mar 2022 14:01:58 +0000 (16:01 +0200)
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
src/shared/bootspec.h

index 188ab1d66351b5c3e203ddfb8d1ca9c889a2dbe6..fd08e22bf9bb35763b159967c5ade50949c45c01 100644 (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;
+}
index 0f199d5ee90c364803bb5bf2d42f05b149cb936b..02ccd90aee73808f1d5a1999d2eda8f639485ce0 100644 (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);