From d3352b997ca59a336a40fe6660c6e5b7079864aa Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sun, 28 Jun 2020 14:58:32 +0200 Subject: Run clang-format on source tree (excl igmp.c) --- shared/utils.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'shared/utils.h') diff --git a/shared/utils.h b/shared/utils.h index 3ed1c87..9171648 100644 --- a/shared/utils.h +++ b/shared/utils.h @@ -12,14 +12,14 @@ extern unsigned debug_mask; -#define _unused_ __attribute__((__unused__)) -#define _pure_ __attribute__((__pure__)) -#define _const_ __attribute__((__const__)) -#define _alloc_(...) __attribute__((__alloc_size__(__VA_ARGS__))) -#define _malloc_ __attribute__((__malloc__)) +#define _unused_ __attribute__((__unused__)) +#define _pure_ __attribute__((__pure__)) +#define _const_ __attribute__((__const__)) +#define _alloc_(...) __attribute__((__alloc_size__(__VA_ARGS__))) +#define _malloc_ __attribute__((__malloc__)) #define _printf_(a, b) __attribute__((__format__(printf, a, b))) -#define _alignas_(x) __attribute__((__aligned__(__alignof(x)))) -#define _big_endian_ __attribute__((packed, scalar_storage_order("big-endian"))) +#define _alignas_(x) __attribute__((__aligned__(__alignof(x)))) +#define _big_endian_ __attribute__((packed, scalar_storage_order("big-endian"))) #if __GNUC__ >= 7 #define _fallthrough_ __attribute__((__fallthrough__)) @@ -35,7 +35,7 @@ extern unsigned debug_mask; #endif #endif -#define STRLEN(x) (sizeof(""x"") - 1) +#define STRLEN(x) (sizeof("" x "") - 1) #include "list.h" #include "debug.h" @@ -56,7 +56,7 @@ extern unsigned debug_mask; struct saddr { union { - struct sockaddr_storage storage; + struct sockaddr_storage st; struct sockaddr_in in4; struct sockaddr_in6 in6; struct sockaddr_ll ll; @@ -74,7 +74,8 @@ uint16_t saddr_port(struct saddr *saddr); void saddr_set_ipv4(struct saddr *saddr, in_addr_t ip, in_port_t port); -void saddr_set_ipv6(struct saddr *saddr, const struct in6_addr *ip, in_port_t port); +void saddr_set_ipv6(struct saddr *saddr, const struct in6_addr *ip, + in_port_t port); void saddr_set_addrstr(struct saddr *saddr); @@ -105,9 +106,11 @@ static inline bool strcaseeq(const char *a, const char *b) #endif #if __BYTE_ORDER == __LITTLE_ENDIAN -#define cinet_addr(a,b,c,d) ((uint32_t)((a)<<0|(b)<<8|(c)<<16|(d)<<24)) +#define cinet_addr(a, b, c, d) \ + ((uint32_t)((a) << 0 | (b) << 8 | (c) << 16 | (d) << 24)) #else -#define cinet_addr(a,b,c,d) ((uint32_t)((a)<<24|(b)<<16|(c)<<8|(d)<<0)) +#define cinet_addr(a, b, c, d) \ + ((uint32_t)((a) << 24 | (b) << 16 | (c) << 8 | (d) << 0)) #endif #define PIPE_RD 0 @@ -117,7 +120,6 @@ static inline bool strcaseeq(const char *a, const char *b) #define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +#define DIV_ROUND_UP(n, d) (((n) + (d)-1) / (d)) #endif - -- cgit v1.2.3