Include shared-macro.h from libratbag-util.h

These headers need merging at some point, for now just include it and remove
the duplicates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-07-13 13:36:47 +10:00
committed by Benjamin Tissoires
parent 7b861ada4c
commit d915fdfe45
2 changed files with 4 additions and 4 deletions

View File

@@ -29,6 +29,8 @@
#include <unistd.h>
#include <libudev.h>
#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)

View File

@@ -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