aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-05-13 10:18:23 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-13 17:02:38 -0700
commit8e9e136d6172824dd77f8f83569ec3e5f7bc08cd (patch)
tree39ae0451347cca8a8ad05865a0ee8062eef748ab
parent831b366c243ecaa450289d76926bb687c746d495 (diff)
downloadgit-8e9e136d6172824dd77f8f83569ec3e5f7bc08cd.tar.gz
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>
-rw-r--r--reftable/block.h2
-rw-r--r--reftable/reftable-writer.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/reftable/block.h b/reftable/block.h
index e91f3d2790..1c8f25ee6e 100644
--- a/reftable/block.h
+++ b/reftable/block.h
@@ -29,7 +29,7 @@ struct block_writer {
uint32_t header_off;
/* How often to restart keys. */
- int restart_interval;
+ uint16_t restart_interval;
int hash_size;
/* Offset of next uint8_t to write. */
diff --git a/reftable/reftable-writer.h b/reftable/reftable-writer.h
index 03df3a4963..94804eaa68 100644
--- a/reftable/reftable-writer.h
+++ b/reftable/reftable-writer.h
@@ -28,7 +28,7 @@ struct reftable_write_options {
unsigned skip_index_objects : 1;
/* how often to write complete keys in each block. */
- int restart_interval;
+ uint16_t restart_interval;
/* 4-byte identifier ("sha1", "s256") of the hash.
* Defaults to SHA1 if unset