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.
This commit is contained in:
Willy Tarreau 2023-12-30 17:24:06 +01:00
parent b7068b3152
commit 5c0128d942
1 changed files with 2 additions and 2 deletions

View File

@ -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 <beg>, or that both are zero.
* We have to find what bit is differing and report it as the number of