Преглед изворни кода

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;
             return idx;
         }
         }
         idx++;
         idx++;
-        if (idx >= index->num_buckets) {
-            idx -= index->num_buckets;
+        if (idx >= index->num_buckets) {  /* triggers at == already */
+            idx = 0;
         }
         }
         if(idx == start) {
         if(idx == start) {
             /* We have done a full pass over all buckets.
             /* We have done a full pass over all buckets.