]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reftable: use `uint16_t` to track restart interval
authorPatrick Steinhardt <ps@pks.im>
Mon, 13 May 2024 08:18:23 +0000 (10:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 May 2024 00:02:38 +0000 (17:02 -0700)
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>
reftable/block.h
reftable/reftable-writer.h

index e91f3d27908f14867ab4749e55ab9676eee24661..1c8f25ee6eb6e5c400594f2b3e9b8d3687dbb837 100644 (file)
@@ -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. */
index 03df3a4963248ea091fa5e207eb767869a7ad438..94804eaa687e983e6d897229bea0bd0676a0c929 100644 (file)
@@ -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