diff --git a/src/libratbag-util.h b/src/libratbag-util.h index be54e5c9..50516984 100644 --- a/src/libratbag-util.h +++ b/src/libratbag-util.h @@ -29,6 +29,8 @@ #include #include +#include "shared-macro.h" + /* * This list data structure is a verbatim copy from wayland-util.h from the * Wayland project; except that wl_ prefix has been removed. @@ -76,8 +78,6 @@ int list_empty(const struct list *list); #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) -#define streq(s1, s2) (strcmp((s1), (s2)) == 0) -#define strneq(s1, s2, n) (strncmp((s1), (s2), (n)) == 0) static inline void cleanup_free(void *p) { @@ -100,7 +100,6 @@ cleanup_udev_device_unref(struct udev_device **udev_device) { udev_device_unref(*udev_device); } -#define _cleanup_(x) __attribute__((cleanup(x))) #define _cleanup_free_ _cleanup_(cleanup_free) #define _cleanup_close_ _cleanup_(cleanup_close) #define _cleanup_udev_unref_ _cleanup_(cleanup_udev_unref) diff --git a/src/shared-macro.h b/src/shared-macro.h index 490f20fc..98ba0f2c 100644 --- a/src/shared-macro.h +++ b/src/shared-macro.h @@ -187,7 +187,8 @@ static inline void safe_closep(int *fd) * @_a: string A * @_b: string B */ -#define streq(_a, _b) (!strcmp((_a), (_b))) +#define streq(_a, _b) (strcmp((_a), (_b)) == 0) +#define strneq(s1, s2, n) (strncmp((s1), (s2), (n)) == 0) /* * streq_ptr() - test whether two strings are equal, considering NULL valid