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

[PATCH 1/2] status: allow NULL fmt for status_printf/status_vprintf_ln

From
Benoit Pierre <benoit.pierre@gmail.com>
Date
Mar 10, 2014, 19:27 UTC
Message-ID
<1394479647-22361-2-git-send-email-benoit.pierre@gmail.com>
In-Reply-To
<1394479647-22361-1-git-send-email-benoit.pierre@gmail.com>

Useful for calling status_printf only to change/reset the color (and output an additional '\n' with status_vprintf_ln).

Signed-off-by: Benoit Pierre <benoit.pierre@gmail.com>
---
 wt-status.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/wt-status.c b/wt-status.c
index 4e55810..17f63a4 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -49,7 +49,8 @@ static void status_vprintf(struct wt_status *s, int at_bol, const char *color,
 	struct strbuf linebuf = STRBUF_INIT;
 	const char *line, *eol;
 
-	strbuf_vaddf(&sb, fmt, ap);
+	if (NULL != fmt)
+	    strbuf_vaddf(&sb, fmt, ap);
 	if (!sb.len) {
 		if (s->display_comment_prefix) {
 			strbuf_addch(&sb, comment_line_char);
-- 
1.9.0
Previous: Benoit PierreNext: Eric Sunshine
Message 2 of 6 in “fix status_printf_ln calls "zero-length format" warnings”
  1. 0/2 fix status_printf_ln calls "zero-length format" warningsBenoit Pierre, Mar 10, 2014
  2. 1/2 status: allow NULL fmt for status_printf/status_vprintf_lnBenoit Pierre, Mar 10, 2014
  3. Eric SunshineMar 10, 2014
  4. 2/2 fix status_printf_ln calls "zero-length format" warningsBenoit Pierre, Mar 10, 2014
  5. Jeff KingMar 10, 2014
  6. Junio C HamanoMar 11, 2014

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.