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

2014-03-10 Thread Benoit Pierre
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.pie...@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

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-03-10 Thread Eric Sunshine
On Mon, Mar 10, 2014 at 3:27 PM, Benoit Pierre benoit.pie...@gmail.com wrote:
 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.pie...@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)

In this codebase,

if (fmt)

would be more idiomatic.

 +   strbuf_vaddf(sb, fmt, ap);
 if (!sb.len) {
 if (s-display_comment_prefix) {
 strbuf_addch(sb, comment_line_char);
 --
 1.9.0
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html