public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] style: Add parentheses to function names in comments
@ 2025-06-20 15:25 Laurent Vivier
  0 siblings, 0 replies; only message in thread
From: Laurent Vivier @ 2025-06-20 15:25 UTC (permalink / raw)
  To: passt-dev; +Cc: Laurent Vivier

The commit updates the style of function comments by adding parentheses
to function names in the descriptions where they are missing.

Done with:

---------8<------ fix_function_name.awk ---------8<------
/^\/\*\*/ {
    check_next = 1;
    print $0
    next
}
check_next == 1 && / \* struct/ {
    check_next = 0
    print $0
    next
}
check_next == 1 && / \* enum/ {
    check_next = 0
    print $0
    next
}
check_next == 1 && /^ \* [^ (]* -/ {
   modified_line = gensub(/^ \* ([^ ]*) -(.*)$/, " * \\1() -\\2", "g", $0)
   print modified_line
   check_next = 0;
   next
}
{
    print $0
    check_next = 0
}
---------8<------ fix_function_name.awk ---------8<------

Then

for file in *.[ch]; do
    cp ${file} ${file}.tmp && \
    awk -f fix_function_name.awk ${file}.tmp > ${file}
done

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 checksum.c   | 4 ++--
 conf.c       | 4 ++--
 fwd.h        | 2 +-
 iov.c        | 2 +-
 netlink.c    | 2 +-
 siphash.h    | 2 +-
 vhost_user.h | 4 ++--
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/checksum.c b/checksum.c
index 0894eca89570..bebcb8aae50e 100644
--- a/checksum.c
+++ b/checksum.c
@@ -452,7 +452,7 @@ less_than_128_bytes:
 }
 
 /**
- * csum_unfolded - Calculate the unfolded checksum of a data buffer.
+ * csum_unfolded() - Calculate the unfolded checksum of a data buffer.
  *
  * @buf:   Input buffer
  * @len:   Input length
@@ -481,7 +481,7 @@ uint32_t csum_unfolded(const void *buf, size_t len, uint32_t init)
 }
 #else /* __AVX2__ */
 /**
- * csum_unfolded - Calculate the unfolded checksum of a data buffer.
+ * csum_unfolded() - Calculate the unfolded checksum of a data buffer.
  *
  * @buf:   Input buffer
  * @len:   Input length
diff --git a/conf.c b/conf.c
index 36845e26d826..5969c9e856e7 100644
--- a/conf.c
+++ b/conf.c
@@ -65,7 +65,7 @@
 const char *pasta_default_ifn = "tap0";
 
 /**
- * next_chunk - Return the next piece of a string delimited by a character
+ * next_chunk() - Return the next piece of a string delimited by a character
  * @s:		String to search
  * @c:		Delimiter character
  *
@@ -80,7 +80,7 @@ static char *next_chunk(const char *s, char c)
 }
 
 /**
- * port_range - Represents a non-empty range of ports
+ * port_range() - Represents a non-empty range of ports
  * @first:	First port number in the range
  * @last:	Last port number in the range (inclusive)
  *
diff --git a/fwd.h b/fwd.h
index 0458a3c5078d..65c7c9641f55 100644
--- a/fwd.h
+++ b/fwd.h
@@ -27,7 +27,7 @@ enum fwd_ports_mode {
 #define PORT_BITMAP_SIZE	DIV_ROUND_UP(NUM_PORTS, 8)
 
 /**
- * fwd_ports - Describes port forwarding for one protocol and direction
+ * fwd_ports() - Describes port forwarding for one protocol and direction
  * @mode:	Overall forwarding mode (all, none, auto, specific ports)
  * @scan4:	/proc/net fd to scan for IPv4 ports when in AUTO mode
  * @scan6:	/proc/net fd to scan for IPv6 ports when in AUTO mode
diff --git a/iov.c b/iov.c
index 91e87a740f0a..d69df61d0d17 100644
--- a/iov.c
+++ b/iov.c
@@ -181,7 +181,7 @@ bool iov_tail_prune(struct iov_tail *tail)
 }
 
 /**
- * iov_tail_size - Calculate the total size of an IO vector tail
+ * iov_tail_size() - Calculate the total size of an IO vector tail
  * @tail:	IO vector tail
  *
  * Returns:    The total size in bytes.
diff --git a/netlink.c b/netlink.c
index ee9325a054a2..8f82e73bb2d1 100644
--- a/netlink.c
+++ b/netlink.c
@@ -199,7 +199,7 @@ static struct nlmsghdr *nl_next(int s, char *buf, struct nlmsghdr *nh, ssize_t *
 }
 
 /**
- * nl_foreach - 'for' type macro to step through netlink response messages
+ * nl_foreach() - 'for' type macro to step through netlink response messages
  * nl_foreach_oftype - as above, but only messages of expected type
  * @nh:		Steps through each response header (struct nlmsghdr *)
  * @status:	When loop exits indicates if there was an error (ssize_t)
diff --git a/siphash.h b/siphash.h
index a2ca2a9989d5..e760236e8063 100644
--- a/siphash.h
+++ b/siphash.h
@@ -99,7 +99,7 @@ static inline void siphash_feed(struct siphash_state *state, uint64_t in)
 }
 
 /**
- * siphash_final - Finalize SipHash calculations
+ * siphash_final() - Finalize SipHash calculations
  * @v:		siphash state (4 x 64-bit integers)
  * @len:	Total length of input data
  * @tail:	Final data for the hash (<= 7 bytes)
diff --git a/vhost_user.h b/vhost_user.h
index f2ae2da63b38..e806a9e54e00 100644
--- a/vhost_user.h
+++ b/vhost_user.h
@@ -217,7 +217,7 @@ struct vhost_user_msg {
 })
 
 /**
- * vu_queue_enabled - Return state of a virtqueue
+ * vu_queue_enabled() - Return state of a virtqueue
  * @vq:		virtqueue to check
  *
  * Return: true if the virqueue is enabled, false otherwise
@@ -228,7 +228,7 @@ static inline bool vu_queue_enabled(const struct vu_virtq *vq)
 }
 
 /**
- * vu_queue_started - Return state of a virtqueue
+ * vu_queue_started() - Return state of a virtqueue
  * @vq:		virtqueue to check
  *
  * Return: true if the virqueue is started, false otherwise
-- 
@@ -217,7 +217,7 @@ struct vhost_user_msg {
 })
 
 /**
- * vu_queue_enabled - Return state of a virtqueue
+ * vu_queue_enabled() - Return state of a virtqueue
  * @vq:		virtqueue to check
  *
  * Return: true if the virqueue is enabled, false otherwise
@@ -228,7 +228,7 @@ static inline bool vu_queue_enabled(const struct vu_virtq *vq)
 }
 
 /**
- * vu_queue_started - Return state of a virtqueue
+ * vu_queue_started() - Return state of a virtqueue
  * @vq:		virtqueue to check
  *
  * Return: true if the virqueue is started, false otherwise
-- 
2.49.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-20 15:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-20 15:25 [PATCH] style: Add parentheses to function names in comments Laurent Vivier

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).