From 5c0128d94284e86b290b0ab51ad0dfb8451c23f7 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 30 Dec 2023 17:24:06 +0100 Subject: [PATCH] IMPORT: ebtree: make string_equal_bits() return an unsigned It used to return ssize_t for -1 but in fact we're using this -1 as the largest possible value and the result is generally cast to signed to check if the end was reached, so better make it clearly return an unsigned value here. This is cbtree commit e1e58a2b2ced2560d4544abaefde595273089704. This is ebtree commit d7531a7475f8ba8e592342ef1240df3330d0ab47. --- include/import/ebtree.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/import/ebtree.h b/include/import/ebtree.h index 7f02902df..31a9cac10 100644 --- a/include/import/ebtree.h +++ b/include/import/ebtree.h @@ -836,7 +836,7 @@ static forceinline int check_bits(const unsigned char *a, * permitted. Equal strings are reported as a negative number of bits, which * indicates the end was reached. */ -static forceinline ssize_t string_equal_bits(const unsigned char *a, +static forceinline size_t string_equal_bits(const unsigned char *a, const unsigned char *b, size_t ignore) { @@ -857,7 +857,7 @@ static forceinline ssize_t string_equal_bits(const unsigned char *a, if (c) break; if (!d) - return -1; + return (size_t)-1; } /* OK now we know that a and b differ at byte , or that both are zero. * We have to find what bit is differing and report it as the number of