]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: drop "static inline" use in .c files
authorLennart Poettering <lennart@poettering.net>
Mon, 21 Aug 2023 16:27:12 +0000 (18:27 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 21 Aug 2023 21:15:12 +0000 (23:15 +0200)
"static inline" makes sense in .h files. But in .c files it's useless
decoration, the compiler should just make its own decisions there, and
it can do that.

hence, replace all remaining uses of "static line" by a simple" static"
in all .c files (but keep them in .h files, where they make sense)

16 files changed:
src/basic/efivars.c
src/boot/efi/boot.c
src/boot/efi/console.c
src/boot/efi/pe.c
src/boot/efi/util.c
src/boot/measure.c
src/core/dbus-util.c
src/libsystemd-network/sd-lldp-rx.c
src/shared/dissect-image.c
src/shared/fdset.c
src/shared/tpm2-util.c
src/shared/user-record-nss.c
src/shared/varlink.c
src/sysusers/sysusers.c
src/test/test-json.c
src/tmpfiles/tmpfiles.c

index 77dc2acd8b19df6495d356448af6812dd2daaf1b..07a2a54f3bc859bf07b8f8a489a8b18846a368a7 100644 (file)
@@ -415,7 +415,7 @@ int systemd_efi_options_variable(char **ret) {
         return r;
 }
 
-static inline int compare_stat_mtime(const struct stat *a, const struct stat *b) {
+static int compare_stat_mtime(const struct stat *a, const struct stat *b) {
         return CMP(timespec_load(&a->st_mtim), timespec_load(&b->st_mtim));
 }
 
index ccba953b412803d7aea8912f0a82ade1f5ec59b4..6c2c488c742692af36a56334f675ac6510100cc8 100644 (file)
@@ -1099,7 +1099,7 @@ static void config_entry_free(ConfigEntry *entry) {
         free(entry);
 }
 
-static inline void config_entry_freep(ConfigEntry **entry) {
+static void config_entry_freep(ConfigEntry **entry) {
         config_entry_free(*entry);
 }
 
index 41ad03cb4627f8f4409a503af697ce437894f70b..067ee7c091c4f92de4c8a9a700c5d4b4ca06ec89 100644 (file)
@@ -10,7 +10,7 @@
 #define VERTICAL_MAX_OK 1080
 #define VIEWPORT_RATIO 10
 
-static inline void event_closep(EFI_EVENT *event) {
+static void event_closep(EFI_EVENT *event) {
         if (!*event)
                 return;
 
index c9bd22704a7395281d237fc891247e2929f2935c..829266b7f599dcfb605926938bab5d97298be636 100644 (file)
@@ -119,12 +119,12 @@ typedef struct PeSectionHeader {
         uint32_t Characteristics;
 } _packed_ PeSectionHeader;
 
-static inline bool verify_dos(const DosFileHeader *dos) {
+static bool verify_dos(const DosFileHeader *dos) {
         assert(dos);
         return memcmp(dos->Magic, DOS_FILE_MAGIC, STRLEN(DOS_FILE_MAGIC)) == 0;
 }
 
-static inline bool verify_pe(const PeFileHeader *pe, bool allow_compatibility) {
+static bool verify_pe(const PeFileHeader *pe, bool allow_compatibility) {
         assert(pe);
         return memcmp(pe->Magic, PE_FILE_MAGIC, STRLEN(PE_FILE_MAGIC)) == 0 &&
                (pe->FileHeader.Machine == TARGET_MACHINE_TYPE ||
@@ -134,7 +134,7 @@ static inline bool verify_pe(const PeFileHeader *pe, bool allow_compatibility) {
                IN_SET(pe->OptionalHeader.Magic, OPTHDR32_MAGIC, OPTHDR64_MAGIC);
 }
 
-static inline size_t section_table_offset(const DosFileHeader *dos, const PeFileHeader *pe) {
+static size_t section_table_offset(const DosFileHeader *dos, const PeFileHeader *pe) {
         assert(dos);
         assert(pe);
         return dos->ExeHeader + offsetof(PeFileHeader, OptionalHeader) + pe->FileHeader.SizeOfOptionalHeader;
index 3beab238d4bcd7d075deea972e267946d3f5355e..fdd5abac2902c8af071f3e9eb45155f9cf8cdd31 100644 (file)
@@ -564,13 +564,13 @@ __attribute__((noinline)) void notify_debugger(const char *identity, volatile bo
 }
 
 #if defined(__i386__) || defined(__x86_64__)
-static inline uint8_t inb(uint16_t port) {
+static uint8_t inb(uint16_t port) {
         uint8_t value;
         asm volatile("inb %1, %0" : "=a"(value) : "Nd"(port));
         return value;
 }
 
-static inline void outb(uint16_t port, uint8_t value) {
+static void outb(uint16_t port, uint8_t value) {
         asm volatile("outb %0, %1" : : "a"(value), "Nd"(port));
 }
 
index 518c41f65c8b75ab345fe590341b22ea857e5ce0..c08386d9fc2d2a09e36aa43fb808affa441b765c 100644 (file)
@@ -43,7 +43,7 @@ STATIC_DESTRUCTOR_REGISTER(arg_public_key, freep);
 STATIC_DESTRUCTOR_REGISTER(arg_phase, strv_freep);
 STATIC_DESTRUCTOR_REGISTER(arg_append, freep);
 
-static inline void free_sections(char*(*sections)[_UNIFIED_SECTION_MAX]) {
+static void free_sections(char*(*sections)[_UNIFIED_SECTION_MAX]) {
         for (UnifiedSection c = 0; c < _UNIFIED_SECTION_MAX; c++)
                 free((*sections)[c]);
 }
index e891cef1efdcc381e00a105b9e50b5e6aa49b59f..d680a64268670c1108bd3505aee5f817751d065a 100644 (file)
@@ -33,7 +33,7 @@ int bus_property_get_triggered_unit(
 BUS_DEFINE_SET_TRANSIENT(mode_t, "u", uint32_t, mode_t, "%04o");
 BUS_DEFINE_SET_TRANSIENT(unsigned, "u", uint32_t, unsigned, "%" PRIu32);
 
-static inline bool valid_user_group_name_or_id_relaxed(const char *u) {
+static bool valid_user_group_name_or_id_relaxed(const char *u) {
         return valid_user_group_name(u, VALID_USER_ALLOW_NUMERIC|VALID_USER_RELAX);
 }
 
index 8dafa418123828802270103dff8ef9b4baf66837..7e2ffd4eabec547ac1c13f0564e52a2065af4bbd 100644 (file)
@@ -452,7 +452,7 @@ static int lldp_rx_start_timer(sd_lldp_rx *lldp_rx, sd_lldp_neighbor *neighbor)
                                 lldp_rx->event_priority, "lldp-rx-timer", true);
 }
 
-static inline int neighbor_compare_func(sd_lldp_neighbor * const *a, sd_lldp_neighbor * const *b) {
+static int neighbor_compare_func(sd_lldp_neighbor * const *a, sd_lldp_neighbor * const *b) {
         assert(a);
         assert(b);
         assert(*a);
index c361a7a4614ee25510dac6da225250b6f89bb7b1..12c805f449d0b5b3939b4a8c240cdc6e72a47b0e 100644 (file)
@@ -2437,7 +2437,7 @@ static int verity_can_reuse(
         return 0;
 }
 
-static inline char* dm_deferred_remove_clean(char *name) {
+static char* dm_deferred_remove_clean(char *name) {
         if (!name)
                 return NULL;
 
index 397918c20bbdde921fb8ef2fc8d7e612ef5a9140..f5dcdce2182a7d5232f11801a255fa85be520a20 100644 (file)
@@ -24,7 +24,7 @@ FDSet *fdset_new(void) {
         return MAKE_FDSET(set_new(NULL));
 }
 
-static inline void fdset_shallow_freep(FDSet **s) {
+static void fdset_shallow_freep(FDSet **s) {
         /* Destroys the set, but does not free the fds inside, like fdset_free()! */
         set_free(MAKE_SET(*ASSERT_PTR(s)));
 }
index 1a3c162624c573c60076455255812632a25bf35e..3b83dafa6fb0320e9e10433335e081228f26ff1a 100644 (file)
@@ -136,7 +136,7 @@ int dlopen_tpm2(void) {
                         DLSYM_ARG(Tss2_MU_TPMT_PUBLIC_Marshal));
 }
 
-static inline void Esys_Freep(void *p) {
+static void Esys_Freep(void *p) {
         if (*(void**) p)
                 sym_Esys_Free(*(void**) p);
 }
@@ -466,14 +466,14 @@ bool tpm2_test_parms(Tpm2Context *c, TPMI_ALG_PUBLIC alg, const TPMU_PUBLIC_PARM
         return rc == TSS2_RC_SUCCESS;
 }
 
-static inline bool tpm2_supports_tpmt_public(Tpm2Context *c, const TPMT_PUBLIC *public) {
+static bool tpm2_supports_tpmt_public(Tpm2Context *c, const TPMT_PUBLIC *public) {
         assert(c);
         assert(public);
 
         return tpm2_test_parms(c, public->type, &public->parameters);
 }
 
-static inline bool tpm2_supports_tpmt_sym_def_object(Tpm2Context *c, const TPMT_SYM_DEF_OBJECT *parameters) {
+static bool tpm2_supports_tpmt_sym_def_object(Tpm2Context *c, const TPMT_SYM_DEF_OBJECT *parameters) {
         assert(c);
         assert(parameters);
 
@@ -484,7 +484,7 @@ static inline bool tpm2_supports_tpmt_sym_def_object(Tpm2Context *c, const TPMT_
         return tpm2_test_parms(c, TPM2_ALG_SYMCIPHER, &parms);
 }
 
-static inline bool tpm2_supports_tpmt_sym_def(Tpm2Context *c, const TPMT_SYM_DEF *parameters) {
+static bool tpm2_supports_tpmt_sym_def(Tpm2Context *c, const TPMT_SYM_DEF *parameters) {
         assert(c);
         assert(parameters);
 
index ea1bc9faac89321ed371fd691582dc90c06ab508..414a49331b106a6033d0235f61ffeea126343c75 100644 (file)
 #define SET_IF(field, condition, value, fallback)  \
         field = (condition) ? (value) : (fallback)
 
-static inline const char* utf8_only(const char *s) {
+static const char* utf8_only(const char *s) {
         return s && utf8_is_valid(s) ? s : NULL;
 }
 
-static inline int strv_extend_strv_utf8_only(char ***dst, char **src, bool filter_duplicates) {
+static int strv_extend_strv_utf8_only(char ***dst, char **src, bool filter_duplicates) {
         _cleanup_free_ char **t = NULL;
         size_t l, j = 0;
 
index 28068c686e31a8d4be096c3a84e379b0afd28b19..fd28655c5a084010ae3c4b05be2ad7bbd5dddfeb 100644 (file)
@@ -265,11 +265,11 @@ DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(varlink_state, VarlinkState);
 
 static int varlink_format_queue(Varlink *v);
 
-static inline const char *varlink_description(Varlink *v) {
+static const char *varlink_description(Varlink *v) {
         return (v ? v->description : NULL) ?: "varlink";
 }
 
-static inline const char *varlink_server_description(VarlinkServer *s) {
+static const char *varlink_server_description(VarlinkServer *s) {
         return (s ? s->description : NULL) ?: "varlink";
 }
 
index d4ae9912c80d56b64b700829900dc1d1ebc0f773..0fcbf261c115744060d73aa167cead6ac01ca459 100644 (file)
@@ -47,7 +47,7 @@ typedef enum ItemType {
         ADD_RANGE =  'r',
 } ItemType;
 
-static inline const char* item_type_to_string(ItemType t) {
+static const char* item_type_to_string(ItemType t) {
         switch (t) {
         case ADD_USER:
                 return "user";
index 3657075a544dead3a6f851448e0dc12e1033fd7a..64024958ac4a8999c42a37ec8fb9628988d524ce 100644 (file)
@@ -663,7 +663,7 @@ TEST(json_append) {
         assert_se(json_variant_equal(v, w));
 }
 
-static inline void json_array_append_with_source_one(bool source) {
+static void json_array_append_with_source_one(bool source) {
         _cleanup_(json_variant_unrefp) JsonVariant *a, *b;
 
         /* Parse two sources, each with a different name and line/column numbers */
index 44302e17d16d09726e4631a2c7b4f76ed04fb518..db2d61dbda9231ede576a8fafa35d3f05e6d17cf 100644 (file)
@@ -241,7 +241,7 @@ static void context_done(Context *c) {
 }
 
 /* Different kinds of errors that mean that information is not available in the environment. */
-static inline bool ERRNO_IS_NOINFO(int r) {
+static bool ERRNO_IS_NOINFO(int r) {
         return IN_SET(abs(r),
                       EUNATCH,    /* os-release or machine-id missing */
                       ENOMEDIUM,  /* machine-id or another file empty */
@@ -537,7 +537,7 @@ static DIR* opendir_nomod(const char *path) {
         return xopendirat_nomod(AT_FDCWD, path);
 }
 
-static inline nsec_t load_statx_timestamp_nsec(const struct statx_timestamp *ts) {
+static nsec_t load_statx_timestamp_nsec(const struct statx_timestamp *ts) {
         assert(ts);
 
         if (ts->tv_sec < 0)