summaryrefslogtreecommitdiffstats
path: root/src/shared/pretty-print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/pretty-print.c')
-rw-r--r--src/shared/pretty-print.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/shared/pretty-print.c b/src/shared/pretty-print.c
index 9d3f6be1f4..0360fa9d72 100644
--- a/src/shared/pretty-print.c
+++ b/src/shared/pretty-print.c
@@ -531,28 +531,14 @@ void clear_progress_bar_impl(const char *prefix) {
}
void draw_progress_bar(const char *prefix, double percentage) {
-
/* We are going output a bunch of small strings that shall appear as a single line to STDERR which is
* unbuffered by default. Let's temporarily turn on full buffering, so that this is passed to the tty
* as a single buffer, to make things more efficient. */
- char buffer[LONG_LINE_MAX];
- setvbuf(stderr, buffer, _IOFBF, sizeof(buffer));
-
+ WITH_BUFFERED_STDERR;
draw_progress_bar_impl(prefix, percentage);
-
- fflush(stderr);
-
- /* Disable buffering again */
- setvbuf(stderr, NULL, _IONBF, 0);
}
void clear_progress_bar(const char *prefix) {
- char buffer[LONG_LINE_MAX];
- setvbuf(stderr, buffer, _IOFBF, sizeof(buffer));
-
+ WITH_BUFFERED_STDERR;
clear_progress_bar_impl(prefix);
-
- fflush(stderr);
-
- setvbuf(stderr, NULL, _IONBF, 0);
}