util: make the newtype comparision functions return bool

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1373>
This commit is contained in:
Peter Hutterer 2025-12-11 12:37:13 +10:00 committed by Marge Bot
parent b3f7b4b1ea
commit e8dfc3bfd6

View file

@ -25,6 +25,8 @@
#include "config.h" #include "config.h"
#include <stdbool.h>
#include "util-macros.h" #include "util-macros.h"
/** /**
@ -102,10 +104,10 @@
static inline int name_##_cmp(name_##_t a, name_##_t b) { \ static inline int name_##_cmp(name_##_t a, name_##_t b) { \
return a.v < b.v ? -1 : (a.v > b.v ? 1 : 0); \ return a.v < b.v ? -1 : (a.v > b.v ? 1 : 0); \
}; \ }; \
static inline int name_##_eq(name_##_t a, type_ b) { return a.v == b; }\ static inline bool name_##_eq(name_##_t a, type_ b) { return a.v == b; }\
static inline int name_##_ne(name_##_t a, type_ b) { return a.v != b; }\ static inline bool name_##_ne(name_##_t a, type_ b) { return a.v != b; }\
static inline int name_##_le(name_##_t a, type_ b) { return a.v <= b; }\ static inline bool name_##_le(name_##_t a, type_ b) { return a.v <= b; }\
static inline int name_##_lt(name_##_t a, type_ b) { return a.v < b; }\ static inline bool name_##_lt(name_##_t a, type_ b) { return a.v < b; }\
static inline int name_##_ge(name_##_t a, type_ b) { return a.v >= b; }\ static inline bool name_##_ge(name_##_t a, type_ b) { return a.v >= b; }\
static inline int name_##_gt(name_##_t a, type_ b) { return a.v > b; }\ static inline bool name_##_gt(name_##_t a, type_ b) { return a.v > b; }\
struct __useless_struct_to_allow_trailing_semicolon__ struct __useless_struct_to_allow_trailing_semicolon__