From 4384cc0dc0c79a2dba1659f8fbffbec9c362e1d5 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Tue, 2 Oct 2018 20:36:37 +0200 Subject: [PATCH] daemon: do not explicitely inline functions As we are using `-Winline`, if it fails, we get a warning. Let the compiler decide if something has to be inlined. As we use only static functions, it should be easy to inline if possible. --- src/daemon/agent.c | 2 +- src/daemon/interfaces-linux.c | 6 +++--- src/daemon/interfaces.c | 11 +++++++++++ src/daemon/protocols/lldp.c | 4 ++-- src/lldpd-structs.h | 11 ----------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/daemon/agent.c b/src/daemon/agent.c index cc7701cb..dd36d943 100644 --- a/src/daemon/agent.c +++ b/src/daemon/agent.c @@ -38,7 +38,7 @@ extern int unregister_sysORTable(oid *, size_t); #define scfg agent_scfg struct lldpd *agent_scfg; -static inline uint8_t +static uint8_t swap_bits(uint8_t n) { n = ((n&0xF0) >>4 ) | ( (n&0x0F) <<4); diff --git a/src/daemon/interfaces-linux.c b/src/daemon/interfaces-linux.c index 32aceb0e..18ecabfe 100644 --- a/src/daemon/interfaces-linux.c +++ b/src/daemon/interfaces-linux.c @@ -446,21 +446,21 @@ struct ethtool_link_usettings { } link_modes; }; -static inline int +static int iflinux_ethtool_link_mode_test_bit(unsigned int nr, const uint32_t *mask) { if (nr >= 32 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32) return 0; return !!(mask[nr / 32] & (1 << (nr % 32))); } -static inline void +static void iflinux_ethtool_link_mode_unset_bit(unsigned int nr, uint32_t *mask) { if (nr >= 32 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32) return; mask[nr / 32] &= ~(1 << (nr % 32)); } -static inline int +static int iflinux_ethtool_link_mode_is_empty(const uint32_t *mask) { for (unsigned int i = 0; diff --git a/src/daemon/interfaces.c b/src/daemon/interfaces.c index d004c70c..3c6c255d 100644 --- a/src/daemon/interfaces.c +++ b/src/daemon/interfaces.c @@ -24,6 +24,17 @@ #include #include +static int +lldpd_af(int af) +{ + switch (af) { + case LLDPD_AF_IPV4: return AF_INET; + case LLDPD_AF_IPV6: return AF_INET6; + case LLDPD_AF_LAST: return AF_MAX; + default: return AF_UNSPEC; + } +} + /* Generic ethernet interface initialization */ /** * Enable multicast on the given interface. diff --git a/src/daemon/protocols/lldp.c b/src/daemon/protocols/lldp.c index c70794d9..aae338d8 100644 --- a/src/daemon/protocols/lldp.c +++ b/src/daemon/protocols/lldp.c @@ -25,7 +25,7 @@ #include #include -inline static int +static int lldpd_af_to_lldp_proto(int af) { switch (af) { @@ -38,7 +38,7 @@ lldpd_af_to_lldp_proto(int af) } } -inline static int +static int lldpd_af_from_lldp_proto(int proto) { switch (proto) { diff --git a/src/lldpd-structs.h b/src/lldpd-structs.h index 4f1a42c1..c3ffa108 100644 --- a/src/lldpd-structs.h +++ b/src/lldpd-structs.h @@ -143,17 +143,6 @@ enum { LLDPD_AF_LAST }; -inline static int -lldpd_af(int af) -{ - switch (af) { - case LLDPD_AF_IPV4: return AF_INET; - case LLDPD_AF_IPV6: return AF_INET6; - case LLDPD_AF_LAST: return AF_MAX; - default: return AF_UNSPEC; - } -} - #define LLDPD_MGMT_MAXADDRSIZE 16 /* sizeof(struct in6_addr) */ union lldpd_address { struct in_addr inet; -- 2.39.5