Skip to contentSkip to conversation

whitespace: remove spacing irregularities

PATCH In review Duncan Roe 2 participants 4 messages Nov 12, 2024 – Nov 28, 2024 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

PATCH v2 1/1 whitespace: remove spacing irregularities

Two distinct actions:
1. Remove trailing spaces and tabs.
2. Remove spaces that are followed by a tab, inserting extra tabs as required.
Action 2 is only performed in the indent region of a line.

---
v2: Only fix spacing in .c files

 src/callback.c          | 4 ++--
 src/socket.c            | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
src/callback.c +2 -2
index f5349c3..703ae80 100644
@@ -21,7 +21,7 @@ static int mnl_cb_error(const struct nlmsghdr *nlh, void *data)
 	const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh);
 
 	if (nlh->nlmsg_len < mnl_nlmsg_size(sizeof(struct nlmsgerr))) {
-		errno = EBADMSG; 
+		errno = EBADMSG;
 		return MNL_CB_ERROR;
 	}
 	/* Netlink subsystems returns the errno value with different signess */
@@ -73,7 +73,7 @@ static inline int __mnl_cb_run(const void *buf, size_t numbytes,
 		}
 
 		/* netlink data message handling */
-		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) { 
+		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) {
 			if (cb_data){
 				ret = cb_data(nlh, data);
 				if (ret <= MNL_CB_STOP)
src/socket.c +3 -3
index 85b6bcc..60ba2cd 100644
@@ -206,7 +206,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
 
 	addr_len = sizeof(nl->addr);
 	ret = getsockname(nl->fd, (struct sockaddr *) &nl->addr, &addr_len);
-	if (ret < 0)	
+	if (ret < 0)
 		return ret;
 
 	if (addr_len != sizeof(nl->addr)) {
@@ -226,7 +226,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
  * \param buf buffer containing the netlink message to be sent
  * \param len number of bytes in the buffer that you want to send
  *
- * On error, it returns -1 and errno is appropriately set. Otherwise, it 
+ * On error, it returns -1 and errno is appropriately set. Otherwise, it
  * returns the number of bytes sent.
  */
 EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
@@ -235,7 +235,7 @@ EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
 	static const struct sockaddr_nl snl = {
 		.nl_family = AF_NETLINK
 	};
-	return sendto(nl->fd, buf, len, 0, 
+	return sendto(nl->fd, buf, len, 0,
 		      (struct sockaddr *) &snl, sizeof(snl));
 }
 
Signature · 1 line
2.46.2
author
#1 lore raw

Hi,

Quoted 67 lines · Duncan Roe

Two distinct actions:
1. Remove trailing spaces and tabs.
2. Remove spaces that are followed by a tab, inserting extra tabs as required.
Action 2 is only performed in the indent region of a line.

---
v2: Only fix spacing in .c files

 src/callback.c          | 4 ++--
 src/socket.c            | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
src/callback.c +2 -2
index f5349c3..703ae80 100644
@@ -21,7 +21,7 @@ static int mnl_cb_error(const struct nlmsghdr *nlh, void *data)
 	const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh);
 
 	if (nlh->nlmsg_len < mnl_nlmsg_size(sizeof(struct nlmsgerr))) {
-		errno = EBADMSG;
+		errno = EBADMSG;
 		return MNL_CB_ERROR;
 	}
 	/* Netlink subsystems returns the errno value with different signess */
@@ -73,7 +73,7 @@ static inline int __mnl_cb_run(const void *buf, size_t numbytes,
 		}
 
 		/* netlink data message handling */
-		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) {
+		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) {
 			if (cb_data){
 				ret = cb_data(nlh, data);
 				if (ret <= MNL_CB_STOP)
src/socket.c +3 -4
index 85b6bcc..60ba2cd 100644
@@ -206,7 +206,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
 
 	addr_len = sizeof(nl->addr);
 	ret = getsockname(nl->fd, (struct sockaddr *) &nl->addr, &addr_len);
-	if (ret < 0)
+	if (ret < 0)
 		return ret;
 
 	if (addr_len != sizeof(nl->addr)) {
@@ -226,7 +226,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
  * \param buf buffer containing the netlink message to be sent
  * \param len number of bytes in the buffer that you want to send
  *
- * On error, it returns -1 and errno is appropriately set. Otherwise, it
+ * On error, it returns -1 and errno is appropriately set. Otherwise, it
  * returns the number of bytes sent.
  */
 EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
@@ -235,7 +235,7 @@ EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
 	static const struct sockaddr_nl snl = {
 		.nl_family = AF_NETLINK
 	};
-	return sendto(nl->fd, buf, len, 0,
+	return sendto(nl->fd, buf, len, 0,
 		      (struct sockaddr *) &snl, sizeof(snl));
 }
 
--
Quoted 3 lines

2.46.2

Can somebody please apply this? I removed the UAPI header patch as Pablo requested.

Cheers ... Duncan.

#2 lore raw
Quoted 77 lines · Duncan Roe

Hi,

Quoted 67 lines · Duncan Roe

Two distinct actions:
1. Remove trailing spaces and tabs.
2. Remove spaces that are followed by a tab, inserting extra tabs as required.
Action 2 is only performed in the indent region of a line.

---
v2: Only fix spacing in .c files

 src/callback.c          | 4 ++--
 src/socket.c            | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
src/callback.c +2 -2
index f5349c3..703ae80 100644
@@ -21,7 +21,7 @@ static int mnl_cb_error(const struct nlmsghdr *nlh, void *data)
 	const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh);
 
 	if (nlh->nlmsg_len < mnl_nlmsg_size(sizeof(struct nlmsgerr))) {
-		errno = EBADMSG;
+		errno = EBADMSG;
 		return MNL_CB_ERROR;
 	}
 	/* Netlink subsystems returns the errno value with different signess */
@@ -73,7 +73,7 @@ static inline int __mnl_cb_run(const void *buf, size_t numbytes,
 		}
 
 		/* netlink data message handling */
-		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) {
+		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) {
 			if (cb_data){
 				ret = cb_data(nlh, data);
 				if (ret <= MNL_CB_STOP)
src/socket.c +3 -4
index 85b6bcc..60ba2cd 100644
@@ -206,7 +206,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
 
 	addr_len = sizeof(nl->addr);
 	ret = getsockname(nl->fd, (struct sockaddr *) &nl->addr, &addr_len);
-	if (ret < 0)
+	if (ret < 0)
 		return ret;
 
 	if (addr_len != sizeof(nl->addr)) {
@@ -226,7 +226,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
  * \param buf buffer containing the netlink message to be sent
  * \param len number of bytes in the buffer that you want to send
  *
- * On error, it returns -1 and errno is appropriately set. Otherwise, it
+ * On error, it returns -1 and errno is appropriately set. Otherwise, it
  * returns the number of bytes sent.
  */
 EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
@@ -235,7 +235,7 @@ EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
 	static const struct sockaddr_nl snl = {
 		.nl_family = AF_NETLINK
 	};
-	return sendto(nl->fd, buf, len, 0,
+	return sendto(nl->fd, buf, len, 0,
 		      (struct sockaddr *) &snl, sizeof(snl));
 }
 
--
Quoted 3 lines

2.46.2

Can somebody please apply this? I removed the UAPI header patch as Pablo requested.

Cheers ... Duncan.

author
#3 lore raw

Hi Pablo,

Quoted 70 lines · Pablo Neira Ayuso
Quoted 69 lines · Duncan Roe

Hi,

Quoted 66 lines · Duncan Roe

Two distinct actions:
1. Remove trailing spaces and tabs.
2. Remove spaces that are followed by a tab, inserting extra tabs as required.
Action 2 is only performed in the indent region of a line.

---
v2: Only fix spacing in .c files

 src/callback.c          | 4 ++--
 src/socket.c            | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
src/callback.c +2 -2
index f5349c3..703ae80 100644
@@ -21,7 +21,7 @@ static int mnl_cb_error(const struct nlmsghdr *nlh, void *data)
 	const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh);
 
 	if (nlh->nlmsg_len < mnl_nlmsg_size(sizeof(struct nlmsgerr))) {
-		errno = EBADMSG;
+		errno = EBADMSG;
 		return MNL_CB_ERROR;
 	}
 	/* Netlink subsystems returns the errno value with different signess */
@@ -73,7 +73,7 @@ static inline int __mnl_cb_run(const void *buf, size_t numbytes,
 		}
 
 		/* netlink data message handling */
-		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) {
+		if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) {
 			if (cb_data){
 				ret = cb_data(nlh, data);
 				if (ret <= MNL_CB_STOP)
src/socket.c +3 -3
index 85b6bcc..60ba2cd 100644
@@ -206,7 +206,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
 
 	addr_len = sizeof(nl->addr);
 	ret = getsockname(nl->fd, (struct sockaddr *) &nl->addr, &addr_len);
-	if (ret < 0)
+	if (ret < 0)
 		return ret;
 
 	if (addr_len != sizeof(nl->addr)) {
@@ -226,7 +226,7 @@ EXPORT_SYMBOL int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups,
  * \param buf buffer containing the netlink message to be sent
  * \param len number of bytes in the buffer that you want to send
  *
- * On error, it returns -1 and errno is appropriately set. Otherwise, it
+ * On error, it returns -1 and errno is appropriately set. Otherwise, it
  * returns the number of bytes sent.
  */
 EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
@@ -235,7 +235,7 @@ EXPORT_SYMBOL ssize_t mnl_socket_sendto(const struct mnl_socket *nl,
 	static const struct sockaddr_nl snl = {
 		.nl_family = AF_NETLINK
 	};
-	return sendto(nl->fd, buf, len, 0,
+	return sendto(nl->fd, buf, len, 0,
 		      (struct sockaddr *) &snl, sizeof(snl));
 }
 
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

--
2.46.2

Can somebody please apply this? I removed the UAPI header patch as Pablo requested.

Cheers ... Duncan.

Did you mean to add something? I see it's still not applied.

Cheers ... Duncan.