From: Willy Tarreau Date: Sun, 17 Dec 2023 16:24:01 +0000 (+0100) Subject: IMPORT: ebtree: switch the sizes and offsets to size_t and ssize_t X-Git-Tag: v3.0-dev1~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fc421e5b3d7892074196f1e2c4154ee0257d614a;p=thirdparty%2Fhaproxy.git IMPORT: ebtree: switch the sizes and offsets to size_t and ssize_t Let's use these in order to avoid 32-64 bit casts on 64 bit platforms. This is cbtree commit e4f4c10fcb5719b626a1ed4f8e4e94d175468c34. This is ebtree commit cc10507385c784d9a9e74ea9595493317d3da99e. --- diff --git a/include/import/ebtree.h b/include/import/ebtree.h index b1666bba72..10583590dd 100644 --- a/include/import/ebtree.h +++ b/include/import/ebtree.h @@ -729,9 +729,9 @@ static forceinline void __eb_delete(struct eb_node *node) * bytes. Note that parts or all of bits may be rechecked. It is only * passed here as a hint to speed up the check. */ -static forceinline int equal_bits(const unsigned char *a, - const unsigned char *b, - int ignore, int len) +static forceinline size_t equal_bits(const unsigned char *a, + const unsigned char *b, + size_t ignore, size_t len) { for (ignore >>= 3, a += ignore, b += ignore, ignore <<= 3; ignore < len; ) { @@ -747,7 +747,7 @@ static forceinline int equal_bits(const unsigned char *a, * it as the number of identical bits. Note that low bit numbers are * assigned to high positions in the byte, as we compare them as strings. */ - ignore -= flsnz8(c); + ignore -= flsnz_long(c); break; } } @@ -795,12 +795,12 @@ 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 int string_equal_bits(const unsigned char *a, - const unsigned char *b, - int ignore) +static forceinline ssize_t string_equal_bits(const unsigned char *a, + const unsigned char *b, + size_t ignore) { - int beg; unsigned long c, d; + size_t beg; beg = ignore >> 3;