summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-05-10 12:33:10 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-05-10 12:33:10 +1000
commit3925936969e993709c832731343ace3ff5e695d0 (patch)
tree0f082d6f00b0b2eec14d0656b5eeb79f25dd558b /src
parent89490d2b344c671721744d7cd4c3a98d14fcfee3 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/libinput-util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libinput-util.h b/src/libinput-util.h
index a9a2b66..9ecded7 100644
--- a/src/libinput-util.h
+++ b/src/libinput-util.h
@@ -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); \