]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/basics: adjust `hash_size()` to return `uint32_t`
authorPatrick Steinhardt <ps@pks.im>
Mon, 20 Jan 2025 16:17:23 +0000 (17:17 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Jan 2025 22:20:29 +0000 (14:20 -0800)
commit57adf71b93efa9f9b4db5147e9fa1235f0a1d5ba
treef5f444b3377c89ae87fdf3c4b444b98e1e281a01
parent5ac65f0d6b867ff031fda03779c2f2613f022b10
reftable/basics: adjust `hash_size()` to return `uint32_t`

The `hash_size()` function returns the number of bytes used by the hash
function. Weirdly enough though, it returns a signed integer for its
size even though the size obviously cannot ever be negative. The only
case where it could be negative is if the function returned an error
when asked for an unknown hash, but we assert(3p) instead.

Adjust the type of `hash_size()` to be `uint32_t` and adapt all places
that use signed integers for the hash size to follow suit. This also
allows us to get rid of a couple asserts that we had which verified that
the size was indeed positive, which further stresses the point that this
refactoring makes sense.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/basics.c
reftable/basics.h
reftable/block.c
reftable/block.h
reftable/reader.c
reftable/record.c
reftable/record.h
reftable/reftable-record.h
t/unit-tests/t-reftable-record.c