Skip to content

Commit d537ce6

Browse files
pks-tgitster
authored andcommitted
reftable/block: use size_t to track restart point index
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0f3415f commit d537ce6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

reftable/block.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ int block_reader_first_key(const struct block_reader *br, struct strbuf *key)
326326
return 0;
327327
}
328328

329-
static uint32_t block_reader_restart_offset(const struct block_reader *br, int i)
329+
static uint32_t block_reader_restart_offset(const struct block_reader *br, size_t idx)
330330
{
331-
return get_be24(br->restart_bytes + 3 * i);
331+
return get_be24(br->restart_bytes + 3 * idx);
332332
}
333333

334334
void block_iter_seek_start(struct block_iter *it, const struct block_reader *br)

0 commit comments

Comments
 (0)