aboutsummaryrefslogtreecommitdiff
path: root/reftable/reftable-record.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-01-20 17:17:23 +0100
committerJunio C Hamano <gitster@pobox.com>2025-01-21 14:20:29 -0800
commit57adf71b93efa9f9b4db5147e9fa1235f0a1d5ba (patch)
treef5f444b3377c89ae87fdf3c4b444b98e1e281a01 /reftable/reftable-record.h
parent5ac65f0d6b867ff031fda03779c2f2613f022b10 (diff)
downloadgit-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/reftable-record.h')
-rw-r--r--reftable/reftable-record.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/reftable/reftable-record.h b/reftable/reftable-record.h
index ddd48eb579..931e594744 100644
--- a/reftable/reftable-record.h
+++ b/reftable/reftable-record.h
@@ -65,7 +65,7 @@ void reftable_ref_record_release(struct reftable_ref_record *ref);
/* returns whether two reftable_ref_records are the same. Useful for testing. */
int reftable_ref_record_equal(const struct reftable_ref_record *a,
- const struct reftable_ref_record *b, int hash_size);
+ const struct reftable_ref_record *b, uint32_t hash_size);
/* reftable_log_record holds a reflog entry */
struct reftable_log_record {
@@ -105,6 +105,6 @@ void reftable_log_record_release(struct reftable_log_record *log);
/* returns whether two records are equal. Useful for testing. */
int reftable_log_record_equal(const struct reftable_log_record *a,
- const struct reftable_log_record *b, int hash_size);
+ const struct reftable_log_record *b, uint32_t hash_size);
#endif