chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:04:18 +0000 (10:04 +0100)
commitbe00b784a382b68bc225cae8b2a6664882362a7e
treea3e18ef7ca10ac38121c47670f0c3d1dbf6d890d
parent724ccdb94309bde65b4e067f7d61f0170e0bbdb2
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