]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
IMPORT: ebtree: switch the sizes and offsets to size_t and ssize_t
authorWilly Tarreau <w@1wt.eu>
Sun, 17 Dec 2023 16:24:01 +0000 (17:24 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 6 Jan 2024 12:35:13 +0000 (13:35 +0100)
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.

include/import/ebtree.h

index b1666bba7277708efaadf62dd330676782745f1a..10583590dd29ea7a8c4a65d352cc228daa10de3e 100644 (file)
@@ -729,9 +729,9 @@ static forceinline void __eb_delete(struct eb_node *node)
  * bytes. Note that parts or all of <ignore> 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;