Matthieu Moy <[email protected]> writes:
> + /* prepend header, only if there's an actual output */
> + if (len) {
> + if (uncommitted)
> + strbuf_addstr(&summary, _("Submodules changed but not
> updated:"));
> + else
> + strbuf_addstr(&summary, _("Submodule changes to be
> committed:"));
> + strbuf_addstr(&summary, "\n\n");
> + }
> + strbuf_addbuf(&summary, &cmd_stdout);
> + strbuf_release(&cmd_stdout);
> +
> + summary_content = strbuf_detach(&summary, &len);
> + strbuf_add_commented_lines(&summary, summary_content, len);
> + free(summary_content);
> +
> + summary_content = strbuf_detach(&summary, &len);
> + fprintf(s->fp, summary_content);
> + free(summary_content);
This "fprintf()" looks bogus to me. How about adding this on top?
wt-status.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index d91661d..1f17652 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -710,9 +710,8 @@ static void wt_status_print_submodule_summary(struct
wt_status *s, int uncommitt
strbuf_add_commented_lines(&summary, summary_content, len);
free(summary_content);
- summary_content = strbuf_detach(&summary, &len);
- fprintf(s->fp, summary_content);
- free(summary_content);
+ fputs(summary.buf, s->fp);
+ strbuf_release(&summary);
}
static void wt_status_print_other(struct wt_status *s,
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html