diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-01-20 17:17:23 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-01-21 14:20:29 -0800 |
| commit | 57adf71b93efa9f9b4db5147e9fa1235f0a1d5ba (patch) | |
| tree | f5f444b3377c89ae87fdf3c4b444b98e1e281a01 /reftable/reader.c | |
| parent | 5ac65f0d6b867ff031fda03779c2f2613f022b10 (diff) | |
| download | git-57adf71b93efa9f9b4db5147e9fa1235f0a1d5ba.tar.xz | |
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>
Diffstat (limited to 'reftable/reader.c')
| -rw-r--r-- | reftable/reader.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/reftable/reader.c b/reftable/reader.c index ea82955c9b..9df8a5ecb1 100644 --- a/reftable/reader.c +++ b/reftable/reader.c @@ -750,7 +750,7 @@ static int reftable_reader_refs_for_unindexed(struct reftable_reader *r, struct table_iter *ti; struct filtering_ref_iterator *filter = NULL; struct filtering_ref_iterator empty = FILTERING_REF_ITERATOR_INIT; - int oid_len = hash_size(r->hash_id); + uint32_t oid_len = hash_size(r->hash_id); int err; REFTABLE_ALLOC_ARRAY(ti, 1); |
