From c66da2d9ef5743d7ccee873b162a8968e4bdf4f1 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 2 Mar 2024 11:33:29 +0800 Subject: [PATCH] shared/pretty-print: use strrepa where appropriate --- src/shared/pretty-print.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/shared/pretty-print.c b/src/shared/pretty-print.c index af44bb2ca2e..b81d1eb40c2 100644 --- a/src/shared/pretty-print.c +++ b/src/shared/pretty-print.c @@ -522,13 +522,10 @@ void clear_progress_bar(const char *prefix) { fputc('\r', stderr); - if (terminal_is_dumb()) { - size_t l = strlen_ptr(prefix); - for (size_t i = 0; i < l; i ++) - fputc(' ', stderr); - - fputs(" ", stderr); - } else + if (terminal_is_dumb()) + fputs(strrepa(" ", strlen_ptr(prefix) + 4), /* 4: %3.0f%% */ + stderr); + else fputs(ANSI_ERASE_TO_END_OF_LINE, stderr); fputc('\r', stderr); -- 2.47.3