git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 15, 2017, 04:02 UTC
Message-ID
<xmqqbmquwywe.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170513090457.s6gmqjdyrj4osmck@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> 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)?
Surely.  Thanks for a careful review.
Show 29 quoted lines
>
> -- >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@peff.net>
> ---
>  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);
Previous: Jeff KingNext: Ben Peart
Message 7 of 16 in “refactor the filter process code into a reusable module”
  1. 00/10 refactor the filter process code into a reusable moduleBen Peart, May 5, 2017
  2. 01/10 convert: remove erroneous tests for errno == EPIPEBen Peart, May 5, 2017
  3. 02/10 pkt-line: fix packet_read_line() to handle len < 0 errorsBen Peart, May 5, 2017
  4. 03/10 pkt-line: add packet_read_line_gently()Ben Peart, May 5, 2017
  5. 04/10 convert: move packet_write_line() into pkt-line as packet_writel()Ben Peart, May 5, 2017
  6. Jeff KingMay 13, 2017
  7. Junio C HamanoMay 15, 2017
  8. 05/10 convert: split start_multi_file_filter() into two separate functionsBen Peart, May 5, 2017
  9. 07/10 convert: Update generic functions to only use generic data structuresBen Peart, May 5, 2017
  10. 09/10 sub-process: move sub-process functions into separate filesBen Peart, May 5, 2017
  11. Jeff KingMay 13, 2017
  12. 10/10 convert: Update subprocess_read_status to not die on EOFBen Peart, May 5, 2017
  13. 08/10 convert: rename reusable sub-process functionsBen Peart, May 5, 2017
  14. 06/10 convert: Separate generic structures and variables from the filter specific onesBen Peart, May 5, 2017
  15. Junio C HamanoMay 8, 2017
  16. Jeff KingMay 13, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.