diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-09-21 12:52:26 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-09-22 08:17:42 +0200 |
commit | 117843fe95f091df1ddc87aaa60f1a2a8698d120 (patch) | |
tree | f08ffd0849bcd84fe704b79df4e76ae4b8e04e02 /src/network/netdev/vrf.c | |
parent | network/netdev: align tables (diff) | |
download | systemd-117843fe95f091df1ddc87aaa60f1a2a8698d120.tar.xz systemd-117843fe95f091df1ddc87aaa60f1a2a8698d120.zip |
network: make DEFINE_NETDEV_CAST() assert on input and output
The macro used to return NULL if input was NULL or had the wrong type. Now
it asserts that input is nonnull and it has the expected type.
There are a few places where a missing or mismatched type was OK, but in a
majority of places, we would do both of the asserts. In various places we'd
only do one, but that was by ommission/mistake. So moving the asserts into the
macro allows us to save some lines.
Diffstat (limited to 'src/network/netdev/vrf.c')
-rw-r--r-- | src/network/netdev/vrf.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c index 05ef3ff13d..b75ec2bcc6 100644 --- a/src/network/netdev/vrf.c +++ b/src/network/netdev/vrf.c @@ -7,16 +7,11 @@ #include "vrf.h" static int netdev_vrf_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) { - Vrf *v; - int r; - - assert(netdev); assert(!link); assert(m); - v = VRF(netdev); - - assert(v); + Vrf *v = VRF(netdev); + int r; r = sd_netlink_message_append_u32(m, IFLA_VRF_TABLE, v->table); if (r < 0) |