mirror of
https://github.com/systemd/systemd.git
synced 2025-02-25 21:57:32 +03:00
tree-wide: drop "static inline" use in .c files
"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)
This commit is contained in:
parent
252adedaaf
commit
cf1ab844a9
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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]);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)));
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -11,11 +11,11 @@
|
||||
#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;
|
||||
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user