From: Mike Yuan Date: Sat, 2 Mar 2024 03:33:29 +0000 (+0800) Subject: shared/pretty-print: use strrepa where appropriate X-Git-Tag: v256-rc1~667^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F31586%2Fhead;p=thirdparty%2Fsystemd.git shared/pretty-print: use strrepa where appropriate --- 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);