]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reftable/block: use `size_t` to track restart point index
authorPatrick Steinhardt <ps@pks.im>
Mon, 13 May 2024 08:47:01 +0000 (10:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 May 2024 00:04:16 +0000 (17:04 -0700)
The function `block_reader_restart_offset()` gets the offset of the
`i`th restart point. `i` is a signed integer though, which is certainly
not the correct type to track indices like this. Furthermore, both
callers end up passing a `size_t`.

Refactor the code to use a `size_t` instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/block.c

index 5942cb4053db85419707a07597bdeb071d35a7bf..00030eee065234dd6692a175fd2072fc3a1c1795 100644 (file)
@@ -326,9 +326,9 @@ int block_reader_first_key(const struct block_reader *br, struct strbuf *key)
        return 0;
 }
 
-static uint32_t block_reader_restart_offset(const struct block_reader *br, int i)
+static uint32_t block_reader_restart_offset(const struct block_reader *br, size_t idx)
 {
-       return get_be24(br->restart_bytes + 3 * i);
+       return get_be24(br->restart_bytes + 3 * idx);
 }
 
 void block_iter_seek_start(struct block_iter *it, const struct block_reader *br)