diff mbox series

[libnetfilter_queue,32/32] whitespace: Fix more checkpatch errors & warnings

Message ID 20240315073347.22628-33-duncan_roe@optusnet.com.au
State New
Headers show
Series [libnetfilter_queue,01/32] src: Convert nfq_open() to use libmnl | expand

Commit Message

Duncan Roe March 15, 2024, 7:33 a.m. UTC
Fix errors & warnings in the copies of linux_list.h & iftable.c.
One possible false +ve:
 typeof(((type *)0)->member) *__mptr = (ptr);
gets "need consistent spacing around '*' (ctx:WxV)"

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 include/libnetfilter_queue/linux_list.h | 10 +++++-----
 src/iftable.c                           | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/include/libnetfilter_queue/linux_list.h b/include/libnetfilter_queue/linux_list.h
index f687d20..738d834 100644
--- a/include/libnetfilter_queue/linux_list.h
+++ b/include/libnetfilter_queue/linux_list.h
@@ -51,8 +51,8 @@ 
  *
  */
 #define container_of(ptr, type, member) ({			\
-	typeof( ((type *)0)->member ) *__mptr = (ptr);	\
-	(type *)( (char *)__mptr - offsetof(type,member) );})
+	typeof(((type *)0)->member) *__mptr = (ptr);	\
+	(type *)((char *)__mptr - offsetof(type, member)); })
 
 /*
  * Circular doubly linked list implementation.
@@ -122,7 +122,7 @@  static inline void list_add(struct list_head *new, struct list_head *head)
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
-static inline void __list_del(struct list_head * prev, struct list_head * next)
+static inline void __list_del(struct list_head *prev, struct list_head *next)
 {
 	next->prev = prev;
 	prev->next = next;
@@ -169,7 +169,7 @@  static inline int list_empty(const struct list_head *head)
  */
 #define list_for_each_entry(pos, head, member)				\
 	for (pos = list_entry((head)->next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
+	     &pos->member != (head);					\
 	     pos = list_entry(pos->member.next, typeof(*pos), member))	\
 
 /**
@@ -182,7 +182,7 @@  static inline int list_empty(const struct list_head *head)
 #define list_for_each_entry_safe(pos, n, head, member)			\
 	for (pos = list_entry((head)->next, typeof(*pos), member),	\
 		n = list_entry(pos->member.next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
+	     &pos->member != (head);					\
 	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
 
 /**
diff --git a/src/iftable.c b/src/iftable.c
index 7eada24..322b18e 100644
--- a/src/iftable.c
+++ b/src/iftable.c
@@ -29,7 +29,7 @@ 
 
 #define NUM_NLIF_BITS 4
 #define NUM_NLIF_ENTRIES (1 << NUM_NLIF_BITS)
-#define NLIF_ENTRY_MASK (NUM_NLIF_ENTRIES -1)
+#define NLIF_ENTRY_MASK (NUM_NLIF_ENTRIES - 1)
 
 static int data_cb(const struct nlmsghdr *nlh, void *data);
 
@@ -192,7 +192,7 @@  struct nlif_handle *nlif_open(void)
 	if (h == NULL)
 		goto err;
 
-	for (i = NUM_NLIF_ENTRIES - 1; i>= 0; i--)
+	for (i = NUM_NLIF_ENTRIES - 1; i >= 0; i--)
 		INIT_LIST_HEAD(&h->ifindex_hash[i]);
 
 	h->nl = mnl_socket_open(NETLINK_ROUTE);
@@ -226,7 +226,7 @@  void nlif_close(struct nlif_handle *h)
 
 	mnl_socket_close(h->nl);
 
-	for (i = NUM_NLIF_ENTRIES - 1; i>= 0; i--) {
+	for (i = NUM_NLIF_ENTRIES - 1; i >= 0; i--) {
 		list_for_each_entry_safe(this, tmp, &h->ifindex_hash[i], head) {
 			list_del((struct list_head *)this);
 			free(this);
@@ -256,7 +256,7 @@  int nlif_catch(struct nlif_handle *h)
 	if (!h->nl)                /* The old library had this test */
 		return -1;
 
-	ret = mnl_socket_recvfrom(h->nl, buf, sizeof buf);
+	ret = mnl_socket_recvfrom(h->nl, buf, sizeof(buf));
 	if (ret == -1)
 		return -1;
 	return mnl_cb_run(buf, ret, 0, h->portid, data_cb, h) == -1 ? -1 : 0;
@@ -303,7 +303,7 @@  int nlif_query(struct nlif_handle *h)
 EXPORT_SYMBOL
 int nlif_fd(struct nlif_handle *h)
 {
-	return h->nl? mnl_socket_get_fd(h->nl) : -1;
+	return h->nl ? mnl_socket_get_fd(h->nl) : -1;
 }
 
 /**