diff --git a/src/libinput-util.h b/src/libinput-util.h index 9ecded7e..6d9bbe23 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -86,8 +87,8 @@ void list_remove(struct list *elm); bool list_empty(const struct list *list); #define container_of(ptr, sample, member) \ - (__typeof__(sample))((char *)(ptr) - \ - ((char *)&((typeof(sample))0)->member)) + (__typeof__(sample))((char *)(ptr) - \ + offsetof(__typeof__(*sample), member)) #define list_for_each(pos, head, member) \ for (pos = 0, pos = container_of((head)->next, pos, member); \