From a1e92eee3e928e33942b35f308621af0d43e91c8 Mon Sep 17 00:00:00 2001 From: Topi Miettinen Date: Tue, 15 Jan 2019 09:12:28 +0200 Subject: [PATCH] Remove 'inline' attributes from static functions in .c files (#11426) Let the compiler perform inlining (see #11397). --- src/basic/hashmap.c | 2 +- src/basic/siphash24.c | 4 ++-- src/basic/user-util.c | 2 +- src/boot/efi/linux.c | 4 ++-- src/core/automount.c | 2 +- src/core/dbus-socket.c | 4 ++-- src/coredump/coredump.c | 4 ++-- src/journal-remote/journal-upload-journal.c | 2 +- src/journal-remote/microhttpd-util.c | 2 +- src/journal/mmap-cache.c | 2 +- src/libsystemd/sd-bus/bus-match.c | 4 ++-- src/libsystemd/sd-login/sd-login.c | 4 ++-- src/libsystemd/sd-network/sd-network.c | 4 ++-- src/libudev/libudev-list.c | 2 +- src/network/networkd-brvlan.c | 2 +- src/resolve/resolved-etc-hosts.c | 4 ++-- src/shared/bus-unit-util.c | 2 +- src/shared/install.c | 6 +++--- src/udev/udev-builtin-input_id.c | 2 +- src/udev/udev-builtin-keyboard.c | 2 +- src/udev/udev-rules.c | 4 ++-- 21 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 5a4bb37..f2e33d2 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -345,7 +345,7 @@ static unsigned base_bucket_hash(HashmapBase *h, const void *p) { } #define bucket_hash(h, p) base_bucket_hash(HASHMAP_BASE(h), p) -static inline void base_set_dirty(HashmapBase *h) { +static void base_set_dirty(HashmapBase *h) { h->dirty = true; } #define hashmap_set_dirty(h) base_set_dirty(HASHMAP_BASE(h)) diff --git a/src/basic/siphash24.c b/src/basic/siphash24.c index bf365b5..6118081 100644 --- a/src/basic/siphash24.c +++ b/src/basic/siphash24.c @@ -23,13 +23,13 @@ #include "siphash24.h" #include "unaligned.h" -static inline uint64_t rotate_left(uint64_t x, uint8_t b) { +static uint64_t rotate_left(uint64_t x, uint8_t b) { assert(b < 64); return (x << b) | (x >> (64 - b)); } -static inline void sipround(struct siphash *state) { +static void sipround(struct siphash *state) { assert(state); state->v0 += state->v1; diff --git a/src/basic/user-util.c b/src/basic/user-util.c index d410c90..65738a7 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c @@ -87,7 +87,7 @@ char *getusername_malloc(void) { return uid_to_name(getuid()); } -static inline bool is_nologin_shell(const char *shell) { +static bool is_nologin_shell(const char *shell) { return PATH_IN_SET(shell, /* 'nologin' is the friendliest way to disable logins for a user account. It prints a nice diff --git a/src/boot/efi/linux.c b/src/boot/efi/linux.c index d160552..5b4c085 100644 --- a/src/boot/efi/linux.c +++ b/src/boot/efi/linux.c @@ -52,7 +52,7 @@ struct SetupHeader { #ifdef __x86_64__ typedef VOID(*handover_f)(VOID *image, EFI_SYSTEM_TABLE *table, struct SetupHeader *setup); -static inline VOID linux_efi_handover(EFI_HANDLE image, struct SetupHeader *setup) { +static VOID linux_efi_handover(EFI_HANDLE image, struct SetupHeader *setup) { handover_f handover; asm volatile ("cli"); @@ -61,7 +61,7 @@ static inline VOID linux_efi_handover(EFI_HANDLE image, struct SetupHeader *setu } #else typedef VOID(*handover_f)(VOID *image, EFI_SYSTEM_TABLE *table, struct SetupHeader *setup) __attribute__((regparm(0))); -static inline VOID linux_efi_handover(EFI_HANDLE image, struct SetupHeader *setup) { +static VOID linux_efi_handover(EFI_HANDLE image, struct SetupHeader *setup) { handover_f handover; handover = (handover_f)((UINTN)setup->code32_start + setup->handover_offset); diff --git a/src/core/automount.c b/src/core/automount.c index de8010b..6db13ab 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -48,7 +48,7 @@ struct expire_data { int ioctl_fd; }; -static inline void expire_data_free(struct expire_data *data) { +static void expire_data_free(struct expire_data *data) { if (!data) return; diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index 37cf9d2..83ac7ad 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -134,11 +134,11 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_VTABLE_END }; -static inline bool check_size_t_truncation(uint64_t t) { +static bool check_size_t_truncation(uint64_t t) { return (size_t) t == t; } -static inline const char* socket_protocol_to_string(int32_t i) { +static const char* socket_protocol_to_string(int32_t i) { if (i == IPPROTO_IP) return ""; diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 516f63d..ecbb4bf 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -142,7 +142,7 @@ static int parse_config(void) { CONFIG_PARSE_WARN, NULL); } -static inline uint64_t storage_size_max(void) { +static uint64_t storage_size_max(void) { if (arg_storage == COREDUMP_STORAGE_EXTERNAL) return arg_external_size_max; if (arg_storage == COREDUMP_STORAGE_JOURNAL) @@ -229,7 +229,7 @@ static int fix_xattr(int fd, const char *context[_CONTEXT_MAX]) { #define filename_escape(s) xescape((s), "./ ") -static inline const char *coredump_tmpfile_name(const char *s) { +static const char *coredump_tmpfile_name(const char *s) { return s ? s : "(unnamed temporary file)"; } diff --git a/src/journal-remote/journal-upload-journal.c b/src/journal-remote/journal-upload-journal.c index be39f7c..7d7e738 100644 --- a/src/journal-remote/journal-upload-journal.c +++ b/src/journal-remote/journal-upload-journal.c @@ -235,7 +235,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) { assert_not_reached("WTF?"); } -static inline void check_update_watchdog(Uploader *u) { +static void check_update_watchdog(Uploader *u) { usec_t after; usec_t elapsed_time; diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c index 6d049d1..5f56919 100644 --- a/src/journal-remote/microhttpd-util.c +++ b/src/journal-remote/microhttpd-util.c @@ -244,7 +244,7 @@ static int get_auth_dn(gnutls_x509_crt_t client_cert, char **buf) { return 0; } -static inline void gnutls_x509_crt_deinitp(gnutls_x509_crt_t *p) { +static void gnutls_x509_crt_deinitp(gnutls_x509_crt_t *p) { gnutls_x509_crt_deinit(*p); } diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c index 90549f1..0dc453e 100644 --- a/src/journal/mmap-cache.c +++ b/src/journal/mmap-cache.c @@ -132,7 +132,7 @@ static void window_free(Window *w) { free(w); } -_pure_ static inline bool window_matches(Window *w, int prot, uint64_t offset, size_t size) { +_pure_ static bool window_matches(Window *w, int prot, uint64_t offset, size_t size) { assert(w); assert(size > 0); diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index ad13540..9642de1 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -49,11 +49,11 @@ * ` BUS_MATCH_LEAF: E */ -static inline bool BUS_MATCH_IS_COMPARE(enum bus_match_node_type t) { +static bool BUS_MATCH_IS_COMPARE(enum bus_match_node_type t) { return t >= BUS_MATCH_SENDER && t <= BUS_MATCH_ARG_HAS_LAST; } -static inline bool BUS_MATCH_CAN_HASH(enum bus_match_node_type t) { +static bool BUS_MATCH_CAN_HASH(enum bus_match_node_type t) { return (t >= BUS_MATCH_MESSAGE_TYPE && t <= BUS_MATCH_PATH) || (t >= BUS_MATCH_ARG && t <= BUS_MATCH_ARG_LAST) || (t >= BUS_MATCH_ARG_HAS && t <= BUS_MATCH_ARG_HAS_LAST); diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index a904c6b..07f21e8 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -945,11 +945,11 @@ _public_ int sd_machine_get_ifindices(const char *machine, int **ifindices) { return nr; } -static inline int MONITOR_TO_FD(sd_login_monitor *m) { +static int MONITOR_TO_FD(sd_login_monitor *m) { return (int) (unsigned long) m - 1; } -static inline sd_login_monitor* FD_TO_MONITOR(int fd) { +static sd_login_monitor* FD_TO_MONITOR(int fd) { return (sd_login_monitor*) (unsigned long) (fd + 1); } diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c index d4b5e24..812826f 100644 --- a/src/libsystemd/sd-network/sd-network.c +++ b/src/libsystemd/sd-network/sd-network.c @@ -276,11 +276,11 @@ _public_ int sd_network_link_get_carrier_bound_by(int ifindex, int **ret) { return network_link_get_ifindexes(ifindex, "CARRIER_BOUND_BY", ret); } -static inline int MONITOR_TO_FD(sd_network_monitor *m) { +static int MONITOR_TO_FD(sd_network_monitor *m) { return (int) (unsigned long) m - 1; } -static inline sd_network_monitor* FD_TO_MONITOR(int fd) { +static sd_network_monitor* FD_TO_MONITOR(int fd) { return (sd_network_monitor*) (unsigned long) (fd + 1); } diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c index 5f6726c..2737326 100644 --- a/src/libudev/libudev-list.c +++ b/src/libudev/libudev-list.c @@ -61,7 +61,7 @@ static void udev_list_node_remove(struct udev_list_node *entry) { } /* return list entry which embeds this node */ -static inline struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) { +static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) { return container_of(node, struct udev_list_entry, node); } diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c index 1d18e29..8f9103f 100644 --- a/src/network/networkd-brvlan.c +++ b/src/network/networkd-brvlan.c @@ -22,7 +22,7 @@ static bool is_bit_set(unsigned bit, uint32_t scope) { return scope & (1 << bit); } -static inline void set_bit(unsigned nr, uint32_t *addr) { +static void set_bit(unsigned nr, uint32_t *addr) { if (nr < BRIDGE_VLAN_BITMAP_MAX) addr[nr / 32] |= (((uint32_t) 1) << (nr % 32)); } diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/resolved-etc-hosts.c index 01cde4a..ee21222 100644 --- a/src/resolve/resolved-etc-hosts.c +++ b/src/resolve/resolved-etc-hosts.c @@ -12,12 +12,12 @@ /* Recheck /etc/hosts at most once every 2s */ #define ETC_HOSTS_RECHECK_USEC (2*USEC_PER_SEC) -static inline void etc_hosts_item_free(EtcHostsItem *item) { +static void etc_hosts_item_free(EtcHostsItem *item) { strv_free(item->names); free(item); } -static inline void etc_hosts_item_by_name_free(EtcHostsItemByName *item) { +static void etc_hosts_item_by_name_free(EtcHostsItemByName *item) { free(item->name); free(item->addresses); free(item); diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index dce8646..9a8051d 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -118,7 +118,7 @@ DEFINE_BUS_APPEND_PARSE_PTR("u", uint32_t, mode_t, parse_mode); DEFINE_BUS_APPEND_PARSE_PTR("u", uint32_t, unsigned, safe_atou); DEFINE_BUS_APPEND_PARSE_PTR("x", int64_t, int64_t, safe_atoi64); -static inline int bus_append_string(sd_bus_message *m, const char *field, const char *eq) { +static int bus_append_string(sd_bus_message *m, const char *field, const char *eq) { int r; r = sd_bus_message_append(m, "(sv)", field, "s", eq); diff --git a/src/shared/install.c b/src/shared/install.c index 3104043..8629304 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -68,7 +68,7 @@ typedef struct { size_t n_rules; } Presets; -static inline bool unit_file_install_info_has_rules(const UnitFileInstallInfo *i) { +static bool unit_file_install_info_has_rules(const UnitFileInstallInfo *i) { assert(i); return !strv_isempty(i->aliases) || @@ -76,13 +76,13 @@ static inline bool unit_file_install_info_has_rules(const UnitFileInstallInfo *i !strv_isempty(i->required_by); } -static inline bool unit_file_install_info_has_also(const UnitFileInstallInfo *i) { +static bool unit_file_install_info_has_also(const UnitFileInstallInfo *i) { assert(i); return !strv_isempty(i->also); } -static inline void presets_freep(Presets *p) { +static void presets_freep(Presets *p) { size_t i; if (!p) diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c index 13e9f01..e3db55b 100644 --- a/src/udev/udev-builtin-input_id.c +++ b/src/udev/udev-builtin-input_id.c @@ -42,7 +42,7 @@ static const struct range high_key_blocks[] = { { KEY_ALS_TOGGLE, BTN_TRIGGER_HAPPY } }; -static inline int abs_size_mm(const struct input_absinfo *absinfo) { +static int abs_size_mm(const struct input_absinfo *absinfo) { /* Resolution is defined to be in units/mm for ABS_X/Y */ return (absinfo->maximum - absinfo->minimum) / absinfo->resolution; } diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c index 1eb91f0..d80cdd2 100644 --- a/src/udev/udev-builtin-keyboard.c +++ b/src/udev/udev-builtin-keyboard.c @@ -89,7 +89,7 @@ static int map_keycode(sd_device *dev, int fd, int scancode, const char *keycode return 0; } -static inline char* parse_token(const char *current, int32_t *val_out) { +static char* parse_token(const char *current, int32_t *val_out) { char *next; int32_t val; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index f697972..7d5b9b7 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -441,8 +441,8 @@ static void dump_rules(UdevRules *rules) { dump_token(rules, &rules->tokens[i]); } #else -static inline void dump_token(UdevRules *rules, struct token *token) {} -static inline void dump_rules(UdevRules *rules) {} +static void dump_token(UdevRules *rules, struct token *token) {} +static void dump_rules(UdevRules *rules) {} #endif /* ENABLE_DEBUG_UDEV */ static int add_token(UdevRules *rules, struct token *token) { -- 2.7.4