mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-05 12:10:28 +01:00
util: fix container_of() macro
Fixes a bunch of warnings of the kind
../src/evdev.h:378:32: warning: variable 'f' is uninitialized when used here [-Wuninitialized]
return container_of(dispatch, f, base);
Just typecasting NULL means we can ignore sample but for the type.
https://bugs.freedesktop.org/show_bug.cgi?id=100976
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
89490d2b34
commit
3925936969
1 changed files with 1 additions and 1 deletions
|
|
@ -87,7 +87,7 @@ bool list_empty(const struct list *list);
|
|||
|
||||
#define container_of(ptr, sample, member) \
|
||||
(__typeof__(sample))((char *)(ptr) - \
|
||||
((char *)&(sample)->member - (char *)(sample)))
|
||||
((char *)&((typeof(sample))0)->member))
|
||||
|
||||
#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