Re: [PATCH v7 04/10] convert: move packet_write_line() into pkt-line as packet_writel()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 05, 2017 at 11:27:56AM -0400, Ben Peart wrote:

> +int packet_writel(int fd, const char *line, ...);

This isn't a new problem, but I noticed that this function should
probably get annotated to describe its interface.

Junio, can you pick up the patch below on top of Ben's series (or I'd be
fine if it were squashed into this patch)?

-- >8 --
Subject: [PATCH] pkt-line: annotate packet_writel with LAST_ARG_MUST_BE_NULL

packet_writel() takes a variable-sized list and reads to
the first NULL. Let's let the compiler know so that it can
help us catch mistakes in the callers.

This should have been annotated similarly when it was a
static function, but it's doubly important now that the
function is available to the whole code-base.

Signed-off-by: Jeff King <peff@xxxxxxxx>
---
 pkt-line.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pkt-line.h b/pkt-line.h
index b2965869a..450183b64 100644
--- a/pkt-line.h
+++ b/pkt-line.h
@@ -25,6 +25,7 @@ void packet_buf_flush(struct strbuf *buf);
 void packet_buf_write(struct strbuf *buf, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
 int packet_flush_gently(int fd);
 int packet_write_fmt_gently(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
+LAST_ARG_MUST_BE_NULL
 int packet_writel(int fd, const char *line, ...);
 int write_packetized_from_fd(int fd_in, int fd_out);
 int write_packetized_from_buf(const char *src_in, size_t len, int fd_out);
-- 
2.13.0.452.g0afc8e12b




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]