瀏覽代碼

implement ht idx wrap around less strangely, add comment

Thomas Waldmann 2 年之前
父節點
當前提交
4f8c4aea19
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/borg/_hashindex.c

+ 2 - 2
src/borg/_hashindex.c

@@ -185,8 +185,8 @@ hashindex_lookup(HashIndex *index, const unsigned char *key, int *start_idx)
             return idx;
         }
         idx++;
-        if (idx >= index->num_buckets) {
-            idx -= index->num_buckets;
+        if (idx >= index->num_buckets) {  /* triggers at == already */
+            idx = 0;
         }
         if(idx == start) {
             /* We have done a full pass over all buckets.