summaryrefslogtreecommitdiff
path: root/progress.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-16 13:56:43 -0700
committerJunio C Hamano <gitster@pobox.com>2017-03-16 13:56:43 -0700
commitf989ac276d310564364482979a78b83d113c4044 (patch)
tree82b91fc09a7a3f36293e5a0199f8032f330d6a6d /progress.c
parent3d0449ded882cb59257a02a50a212d2e49eca634 (diff)
parent2cfa83574c4b2685208a1e6062fdc573c887cf00 (diff)
Merge branch 'mm/two-more-xstrfmt' into maint
Code clean-up and a string truncation fix. * mm/two-more-xstrfmt: bisect_next_all: convert xsnprintf to xstrfmt stop_progress_msg: convert xsnprintf to xstrfmt
Diffstat (limited to 'progress.c')
-rw-r--r--progress.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/progress.c b/progress.c
index 76a88c573f..29378caa05 100644
--- a/progress.c
+++ b/progress.c
@@ -243,21 +243,18 @@ void stop_progress_msg(struct progress **p_progress, const char *msg)
*p_progress = NULL;
if (progress->last_value != -1) {
/* Force the last update */
- char buf[128], *bufp;
- size_t len = strlen(msg) + 5;
+ char *buf;
struct throughput *tp = progress->throughput;
- bufp = (len < sizeof(buf)) ? buf : xmallocz(len);
if (tp) {
unsigned int rate = !tp->avg_misecs ? 0 :
tp->avg_bytes / tp->avg_misecs;
throughput_string(&tp->display, tp->curr_total, rate);
}
progress_update = 1;
- xsnprintf(bufp, len + 1, ", %s.\n", msg);
- display(progress, progress->last_value, bufp);
- if (buf != bufp)
- free(bufp);
+ buf = xstrfmt(", %s.\n", msg);
+ display(progress, progress->last_value, buf);
+ free(buf);
}
clear_progress_signal();
if (progress->throughput)