Skip to content

Commit 36ddee9

Browse files
committed
Merge branch 'jk/progress-delay-fix'
A regression in the progress eye-candy was fixed. * jk/progress-delay-fix: progress: drop delay-threshold code progress: set default delay threshold to 100%, not 0%
2 parents 7065665 + 9c5951c commit 36ddee9

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

progress.c

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ struct progress {
3434
unsigned total;
3535
unsigned last_percent;
3636
unsigned delay;
37-
unsigned delayed_percent_threshold;
3837
struct throughput *throughput;
3938
uint64_t start_ns;
4039
};
@@ -83,20 +82,8 @@ static int display(struct progress *progress, unsigned n, const char *done)
8382
{
8483
const char *eol, *tp;
8584

86-
if (progress->delay) {
87-
if (!progress_update || --progress->delay)
88-
return 0;
89-
if (progress->total) {
90-
unsigned percent = n * 100 / progress->total;
91-
if (percent > progress->delayed_percent_threshold) {
92-
/* inhibit this progress report entirely */
93-
clear_progress_signal();
94-
progress->delay = -1;
95-
progress->total = 0;
96-
return 0;
97-
}
98-
}
99-
}
85+
if (progress->delay && (!progress_update || --progress->delay))
86+
return 0;
10087

10188
progress->last_value = n;
10289
tp = (progress->throughput) ? progress->throughput->display.buf : "";
@@ -206,7 +193,7 @@ int display_progress(struct progress *progress, unsigned n)
206193
}
207194

208195
static struct progress *start_progress_delay(const char *title, unsigned total,
209-
unsigned percent_threshold, unsigned delay)
196+
unsigned delay)
210197
{
211198
struct progress *progress = malloc(sizeof(*progress));
212199
if (!progress) {
@@ -219,7 +206,6 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
219206
progress->total = total;
220207
progress->last_value = -1;
221208
progress->last_percent = -1;
222-
progress->delayed_percent_threshold = percent_threshold;
223209
progress->delay = delay;
224210
progress->throughput = NULL;
225211
progress->start_ns = getnanotime();
@@ -229,12 +215,12 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
229215

230216
struct progress *start_delayed_progress(const char *title, unsigned total)
231217
{
232-
return start_progress_delay(title, total, 0, 2);
218+
return start_progress_delay(title, total, 2);
233219
}
234220

235221
struct progress *start_progress(const char *title, unsigned total)
236222
{
237-
return start_progress_delay(title, total, 0, 0);
223+
return start_progress_delay(title, total, 0);
238224
}
239225

240226
void stop_progress(struct progress **p_progress)

0 commit comments

Comments
 (0)