mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 01:41:57 -04:00
Merge pull request #6816 from ThomasWaldmann/fix-hashindex-compact-1.2
hashindex_compact: fix eval order (check idx before use), fixes #5899
This commit is contained in:
commit
9c463dc46b
1 changed files with 3 additions and 3 deletions
|
|
@ -664,11 +664,11 @@ hashindex_compact(HashIndex *index)
|
|||
while(idx < index->num_buckets) {
|
||||
/* Phase 1: Find some empty slots */
|
||||
start_idx = idx;
|
||||
while((BUCKET_IS_EMPTY(index, idx) || BUCKET_IS_DELETED(index, idx)) && idx < index->num_buckets) {
|
||||
while((idx < index->num_buckets) && (BUCKET_IS_EMPTY(index, idx) || BUCKET_IS_DELETED(index, idx))) {
|
||||
idx++;
|
||||
}
|
||||
|
||||
/* everything from start_idx to idx is empty or deleted */
|
||||
/* everything from start_idx to idx-1 (inclusive) is empty or deleted */
|
||||
count = empty_slot_count = idx - start_idx;
|
||||
begin_used_idx = idx;
|
||||
|
||||
|
|
@ -682,7 +682,7 @@ hashindex_compact(HashIndex *index)
|
|||
|
||||
/* Phase 2: Find some non-empty/non-deleted slots we can move to the compact tail */
|
||||
|
||||
while(!(BUCKET_IS_EMPTY(index, idx) || BUCKET_IS_DELETED(index, idx)) && empty_slot_count && idx < index->num_buckets) {
|
||||
while(empty_slot_count && (idx < index->num_buckets) && !(BUCKET_IS_EMPTY(index, idx) || BUCKET_IS_DELETED(index, idx))) {
|
||||
idx++;
|
||||
empty_slot_count--;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue