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

Re: [PATCH 2/3] column: allow for custom printf

From
Jeff King <peff@peff.net>
Date
Mar 30, 2017, 03:12 UTC
Message-ID
<20170330031232.cac2av5v5mk5bz7e@sigill.intra.peff.net>
In-Reply-To
<20170330014238.30032-3-sbeller@google.com>
On Wed, Mar 29, 2017 at 06:42:37PM -0700, Stefan Beller wrote:
> Signed-off-by: Stefan Beller <sbeller@google.com>
No justification?
I assume it will be used in a future patch.
Show 12 quoted lines
> diff --git a/column.h b/column.h
> index 0a61917fa7..c44a1525a9 100644
> --- a/column.h
> +++ b/column.h
> @@ -24,6 +24,9 @@ struct column_options {
>  	int padding;
>  	const char *indent;
>  	const char *nl;
> +
> +	/* when non-NULL, use this printing function, fallback to printf */
> +	int (*_printf)(const char *__format, ...);
>  };

Avoid names with leading underscores. They're reserved by the C standard.

I wonder if gcc is smart enough to let us mark this function pointer with a "format" attribute so we can get compile-time checking of the format string.

-Peff
Previous: Stefan BellerNext: Duy Nguyen
Message 3 of 9 in “Respect column.ui in commented status in git-commit”
  1. 0/3 Respect column.ui in commented status in git-commitStefan Beller, Mar 30, 2017
  2. 2/3 column: allow for custom printfStefan Beller, Mar 30, 2017
  3. Jeff KingMar 30, 2017
  4. Duy NguyenApr 10, 2017
  5. 3/3 WIP - Allow custom printf function for column printingStefan Beller, Mar 30, 2017
  6. Jeff KingMar 30, 2017
  7. Stefan BellerMar 30, 2017
  8. Duy NguyenApr 10, 2017
  9. 1/3 column.c: pass column_options to down to display_plainStefan Beller, Mar 30, 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.