From 5ac65f0d6b867ff031fda03779c2f2613f022b10 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 20 Jan 2025 17:17:22 +0100 Subject: reftable/basics: adjust `common_prefix_size()` to return `size_t` The `common_prefix_size()` function computes the length of the common prefix between two buffers. As such its return value will always be an unsigned integer, as the length cannot be negative. Regardless of that, the function returns a signed integer, which is nonsensical and causes a couple of -Wsign-compare warnings all over the place. Adjust the function to return a `size_t` instead. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- t/unit-tests/t-reftable-basics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/unit-tests/t-reftable-basics.c') diff --git a/t/unit-tests/t-reftable-basics.c b/t/unit-tests/t-reftable-basics.c index 1d640b280f..9ba7eb05ad 100644 --- a/t/unit-tests/t-reftable-basics.c +++ b/t/unit-tests/t-reftable-basics.c @@ -120,7 +120,7 @@ int cmd_main(int argc UNUSED, const char *argv[] UNUSED) for (size_t i = 0; i < ARRAY_SIZE(cases); i++) { check(!reftable_buf_addstr(&a, cases[i].a)); check(!reftable_buf_addstr(&b, cases[i].b)); - check_int(common_prefix_size(&a, &b), ==, cases[i].want); + check_uint(common_prefix_size(&a, &b), ==, cases[i].want); reftable_buf_reset(&a); reftable_buf_reset(&b); } -- cgit v1.2.3