mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-05 07:30:27 +01:00
util: drop GCC specifics for container_of
clang supports __typeof__ which was the only real difference. Not sure any other compilers matter (that don't support __typeof__) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Armin Krezović <krezovic.armin@gmail.com> Tested-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
parent
e877fd605c
commit
89490d2b34
1 changed files with 0 additions and 6 deletions
|
|
@ -85,15 +85,9 @@ void list_insert(struct list *list, struct list *elm);
|
|||
void list_remove(struct list *elm);
|
||||
bool list_empty(const struct list *list);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define container_of(ptr, sample, member) \
|
||||
(__typeof__(sample))((char *)(ptr) - \
|
||||
((char *)&(sample)->member - (char *)(sample)))
|
||||
#else
|
||||
#define container_of(ptr, sample, member) \
|
||||
(void *)((char *)(ptr) - \
|
||||
((char *)&(sample)->member - (char *)(sample)))
|
||||
#endif
|
||||
|
||||
#define list_for_each(pos, head, member) \
|
||||
for (pos = 0, pos = container_of((head)->next, pos, member); \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue