reftable: use `uint16_t` to track restart interval
The restart interval can at most be `UINT16_MAX` as specified in the technical documentation of the reftable format. Furthermore, it cannot ever be negative. Regardless of that we use an `int` to track the restart interval. Change the type to use an `uint16_t` instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
May 13, 2024 at 10:18 UTC
8e9e136d6172824dd77f8f83569ec3e5f7bc08cd
2 files changed
+2
-2
reftable/block.h
+1
-1
@@ -29,7 +29,7 @@ struct block_writer {
29
uint32_t header_off;
30
31
/* How often to restart keys. */
32
- int restart_interval;
32
+ uint16_t restart_interval;
33
int hash_size;
34
35
/* Offset of next uint8_t to write. */
reftable/reftable-writer.h
+1
-1
@@ -28,7 +28,7 @@ struct reftable_write_options {
28
unsigned skip_index_objects : 1;
29
30
/* how often to write complete keys in each block. */
31
- int restart_interval;
31
+ uint16_t restart_interval;
32
33
/* 4-byte identifier ("sha1", "s256") of the hash.
34
* Defaults to SHA1 if unset