]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/libsystemd/sd-netlink/netlink-message.c
sd-netlink: don't access type->type_system[_union] directly
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 23 Jun 2015 08:51:25 +0000 (10:51 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Wed, 24 Jun 2015 11:45:47 +0000 (13:45 +0200)
commitc658008f50fdbc617e6f7ad321c058f3a6f175f5
treec2fb5229335daa4dadbbd0c8faf541e862418934
parentcafbc790d1affec2c9524c5ee1915485a1ac6879
sd-netlink: don't access type->type_system[_union] directly

Make sure we never access type->type_system or type->type_system_union
directly. This is an implementation detail of the type-system and we
should always use the accessors. Right now, they only exist for 2-level
accesses (type-system to type-system). This patch introduces the 1-level
accessors (type to type-system) and makes use of it.

This patch makes sure the proper assertions are in place, so we never
accidentally access sub-type-systems for non-nested/union types.

Note that this places hard-asserts on the accessors. This should be fine,
as we expect callers to only access sub type-systems if they *know*
they're dealing with nested types.
src/libsystemd/sd-netlink/netlink-message.c
src/libsystemd/sd-netlink/netlink-types.c
src/libsystemd/sd-netlink/netlink-types.h