Git fork

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%

+5 -19
+5 -19
progress.c
··· 34 34 unsigned total; 35 35 unsigned last_percent; 36 36 unsigned delay; 37 - unsigned delayed_percent_threshold; 38 37 struct throughput *throughput; 39 38 uint64_t start_ns; 40 39 }; ··· 83 82 { 84 83 const char *eol, *tp; 85 84 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; 100 87 101 88 progress->last_value = n; 102 89 tp = (progress->throughput) ? progress->throughput->display.buf : ""; ··· 206 193 } 207 194 208 195 static struct progress *start_progress_delay(const char *title, unsigned total, 209 - unsigned percent_threshold, unsigned delay) 196 + unsigned delay) 210 197 { 211 198 struct progress *progress = malloc(sizeof(*progress)); 212 199 if (!progress) { ··· 219 206 progress->total = total; 220 207 progress->last_value = -1; 221 208 progress->last_percent = -1; 222 - progress->delayed_percent_threshold = percent_threshold; 223 209 progress->delay = delay; 224 210 progress->throughput = NULL; 225 211 progress->start_ns = getnanotime(); ··· 229 215 230 216 struct progress *start_delayed_progress(const char *title, unsigned total) 231 217 { 232 - return start_progress_delay(title, total, 0, 2); 218 + return start_progress_delay(title, total, 2); 233 219 } 234 220 235 221 struct progress *start_progress(const char *title, unsigned total) 236 222 { 237 - return start_progress_delay(title, total, 0, 0); 223 + return start_progress_delay(title, total, 0); 238 224 } 239 225 240 226 void stop_progress(struct progress **p_progress)