Move the update counter to earlier in the hash_search so it still updates even when there are not matches.

This commit is contained in:
Con Kolivas 2012-03-11 21:12:44 +11:00
parent 704d7b5eb6
commit 19b0636459

37
rzip.c
View file

@ -635,6 +635,25 @@ static bool hash_search(rzip_control *control, struct rzip_state *st, double pct
sb->offset_search = p;
if (unlikely(sb->offset_search > sb->offset_low + sb->size_low))
remap_low_sb(control, &control->sb);
if (unlikely(p % 128 == 0)) {
int pct, chunk_pct;
pct = pct_base + (pct_multiple * (100.0 * p) /
(st->chunk_size ? : 1));
chunk_pct = p / ((end / 100) ? : 1);
if (pct != lastpct || chunk_pct != last_chunkpct) {
if (!STDIN || st->stdin_eof)
print_progress("Total: %2d%% ", pct);
print_progress("Chunk: %2d%%\r", chunk_pct);
if (control->info_cb)
control->info_cb(control->info_data,
(!STDIN || st->stdin_eof) ? pct : -1, chunk_pct);
lastpct = pct;
last_chunkpct = chunk_pct;
}
}
next_tag(control, st, p, &t);
/* Don't look for a match if there are no tags with
@ -674,24 +693,6 @@ static bool hash_search(rzip_control *control, struct rzip_state *st, double pct
return false;
}
if (unlikely(p % 128 == 0)) {
int pct, chunk_pct;
pct = pct_base + (pct_multiple * (100.0 * p) /
(st->chunk_size ? : 1));
chunk_pct = p / ((end / 100) ? : 1);
if (pct != lastpct || chunk_pct != last_chunkpct) {
if (!STDIN || st->stdin_eof)
print_progress("Total: %2d%% ", pct);
print_progress("Chunk: %2d%%\r", chunk_pct);
if (control->info_cb)
control->info_cb(control->info_data,
(!STDIN || st->stdin_eof) ? pct : -1, chunk_pct);
lastpct = pct;
last_chunkpct = chunk_pct;
}
}
if (p > cksum_limit) {
/* We lock the mutex here and unlock it in the
* cksumthread. This lock protects all the data in