From d57fafadadcedac7ec55379757b0e24e27f5e20f Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 8 Feb 2023 19:50:44 +0100 Subject: [PATCH] Simplify full HT scan assertion --- src/borg/_hashindex.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/borg/_hashindex.c b/src/borg/_hashindex.c index aff440974..e40d6dfba 100644 --- a/src/borg/_hashindex.c +++ b/src/borg/_hashindex.c @@ -176,16 +176,14 @@ hashindex_lookup(HashIndex *index, const unsigned char *key, int *start_idx) if (idx >= index->num_buckets) { /* triggers at == already */ idx = 0; } - if(idx == start) { - /* We have done a full pass over all buckets. - * - We did not find a bucket with the key we searched for. - * - We did not find an empty bucket either. - * So all buckets are either full or deleted/tombstones. - * This is an invalid state we never should get into, see - * upper_limit and min_empty. - */ - assert(0); /* should never happen - something is wrong here. */ - } + /* When idx == start, we have done a full pass over all buckets. + * - We did not find a bucket with the key we searched for. + * - We did not find an empty bucket either. + * So all buckets are either full or deleted/tombstones. + * This is an invalid state we never should get into, see + * upper_limit and min_empty. + */ + assert(idx != start); } /* we get here if we did not find a bucket with the key we searched for. */ if (start_idx != NULL) {