use offsetof macro to make scan-build happy
authorPetr Štetiar <ynezz@true.cz>
Tue, 29 Oct 2019 05:40:57 +0000 (06:40 +0100)
committerPetr Štetiar <ynezz@true.cz>
Tue, 29 Oct 2019 21:16:00 +0000 (22:16 +0100)
commit1f73b6a8e67881834b0512d3e07aaaf17e71b49e
tree048b897ea89670f71c099a16a091e9412852ef6a
parent0230d0698e596ab2e836abd2459d970b14bacb25
use offsetof macro to make scan-build happy

scan-build from clang version 9 complains about following:

 cache.c:106:2: warning: Dereference of null pointer
        nl_list_for_each_entry_safe(obj, tmp, &cache->c_items, ce_list)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 include/netlink/list.h:83:20: note: expanded from macro 'nl_list_for_each_entry_safe'
             pos = n, n = nl_list_entry(n->member.next, typeof(*n), member))
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 include/netlink/list.h:60:2: note: expanded from macro 'nl_list_entry'
        nl_container_of(ptr, type, member)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 include/netlink/list.h:56:55: note: expanded from macro 'nl_container_of'
        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
                                                      ^~~~~

Signed-off-by: Petr Štetiar <ynezz@true.cz>
include/netlink/list.h