]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/eytzinger.h
Update bcachefs sources to 481b5f343248 bcachefs: Better error messages for missing...
[bcachefs-tools-debian] / libbcachefs / eytzinger.h
index 05429c9631cdad6eced17ff7638cd61651e12bf5..b04750dbf870bc78c95ece35d363e3a4c0936b50 100644 (file)
@@ -156,7 +156,7 @@ static inline unsigned inorder_to_eytzinger1(unsigned i, unsigned size)
 }
 
 #define eytzinger1_for_each(_i, _size)                 \
-       for ((_i) = eytzinger1_first((_size));          \
+       for (unsigned (_i) = eytzinger1_first((_size)); \
             (_i) != 0;                                 \
             (_i) = eytzinger1_next((_i), (_size)))
 
@@ -227,7 +227,7 @@ static inline unsigned inorder_to_eytzinger0(unsigned i, unsigned size)
 }
 
 #define eytzinger0_for_each(_i, _size)                 \
-       for ((_i) = eytzinger0_first((_size));          \
+       for (unsigned (_i) = eytzinger0_first((_size)); \
             (_i) != -1;                                \
             (_i) = eytzinger0_next((_i), (_size)))
 
@@ -261,11 +261,11 @@ static inline ssize_t eytzinger0_find_le(void *base, size_t nr, size_t size,
 
 #define eytzinger0_find(base, nr, size, _cmp, search)                  \
 ({                                                                     \
-       void *_base     = (base);                                       \
-       void *_search   = (search);                                     \
-       size_t _nr      = (nr);                                         \
-       size_t _size    = (size);                                       \
-       size_t _i       = 0;                                            \
+       void *_base             = (base);                               \
+       const void *_search     = (search);                             \
+       size_t _nr              = (nr);                                 \
+       size_t _size            = (size);                               \
+       size_t _i               = 0;                                    \
        int _res;                                                       \
                                                                        \
        while (_i < _nr &&                                              \