1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

pretty-print: rename {draw,clear}_progress_bar_unbuffered() -> {draw,clear}_progress_bar_impl()

Addresses https://github.com/systemd/systemd/pull/34205#discussion_r1739648525.
Follow-ups for 5f9dd9c64d.
This commit is contained in:
Yu Watanabe 2024-09-01 16:07:28 +09:00
parent a833dc9b35
commit b9e4b2c569
3 changed files with 13 additions and 13 deletions

View File

@ -460,7 +460,7 @@ bool shall_tint_background(void) {
return cache != 0;
}
void draw_progress_bar_unbuffered(const char *prefix, double percentage) {
void draw_progress_bar_impl(const char *prefix, double percentage) {
fputc('\r', stderr);
if (prefix) {
fputs(prefix, stderr);
@ -516,7 +516,7 @@ void draw_progress_bar_unbuffered(const char *prefix, double percentage) {
}
void clear_progress_bar_unbuffered(const char *prefix) {
void clear_progress_bar_impl(const char *prefix) {
fputc('\r', stderr);
if (terminal_is_dumb())
@ -538,7 +538,7 @@ void draw_progress_bar(const char *prefix, double percentage) {
char buffer[LONG_LINE_MAX];
setvbuf(stderr, buffer, _IOFBF, sizeof(buffer));
draw_progress_bar_unbuffered(prefix, percentage);
draw_progress_bar_impl(prefix, percentage);
fflush(stderr);
@ -550,7 +550,7 @@ void clear_progress_bar(const char *prefix) {
char buffer[LONG_LINE_MAX];
setvbuf(stderr, buffer, _IOFBF, sizeof(buffer));
clear_progress_bar_unbuffered(prefix);
clear_progress_bar_impl(prefix);
fflush(stderr);

View File

@ -55,5 +55,5 @@ bool shall_tint_background(void);
void draw_progress_bar(const char *prefix, double percentage);
void clear_progress_bar(const char *prefix);
void draw_progress_bar_unbuffered(const char *prefix, double percentage);
void clear_progress_bar_unbuffered(const char *prefix);
void draw_progress_bar_impl(const char *prefix, double percentage);
void clear_progress_bar_impl(const char *prefix);

View File

@ -815,23 +815,23 @@ static int update_render_progress(sd_event_source *source, void *userdata) {
int progress = PTR_TO_INT(p);
if (progress == UPDATE_PROGRESS_FAILED) {
clear_progress_bar_unbuffered(target);
clear_progress_bar_impl(target);
fprintf(stderr, "%s: %s Unknown failure\n", target, RED_CROSS_MARK());
total += 100;
} else if (progress == -EALREADY) {
clear_progress_bar_unbuffered(target);
clear_progress_bar_impl(target);
fprintf(stderr, "%s: %s Already up-to-date\n", target, GREEN_CHECK_MARK());
n--; /* Don't consider this target in the total */
} else if (progress < 0) {
clear_progress_bar_unbuffered(target);
clear_progress_bar_impl(target);
fprintf(stderr, "%s: %s %s\n", target, RED_CROSS_MARK(), STRERROR(progress));
total += 100;
} else if (progress == UPDATE_PROGRESS_DONE) {
clear_progress_bar_unbuffered(target);
clear_progress_bar_impl(target);
fprintf(stderr, "%s: %s Done\n", target, GREEN_CHECK_MARK());
total += 100;
} else {
draw_progress_bar_unbuffered(target, progress);
draw_progress_bar_impl(target, progress);
fputs("\n", stderr);
total += progress;
}
@ -839,9 +839,9 @@ static int update_render_progress(sd_event_source *source, void *userdata) {
if (n > 1) {
if (exiting)
clear_progress_bar_unbuffered(target);
clear_progress_bar_impl(target);
else {
draw_progress_bar_unbuffered("Total", (double) total / n);
draw_progress_bar_impl("Total", (double) total / n);
if (terminal_is_dumb())
fputs("\n", stderr);
}