diff options
author | Oto Šťáva <oto.stava@nic.cz> | 2023-03-15 08:19:42 +0100 |
---|---|---|
committer | Oto Šťáva <oto.stava@nic.cz> | 2023-03-17 08:18:43 +0100 |
commit | 1ff88476401c6933a2e5869582158cd111c35c7d (patch) | |
tree | 96f82ca58a8f15f6111944aa811c13d66c859f4f /daemon/io.c | |
parent | daemon: improve session closure readability (diff) | |
download | knot-resolver-1ff88476401c6933a2e5869582158cd111c35c7d.tar.xz knot-resolver-1ff88476401c6933a2e5869582158cd111c35c7d.zip |
daemon: use a struct member for 'inheritance' to avoid aliasing issues
It has been brought to my attention that using a macro to put an
identical member sequence at the beginning of multiple structs to
simulate OOP-like inheritance (the way libUV does it) may violate strict
aliasing rules. The standards-compliant way to do this should be to use
a single common struct member, as opposed to a common sequence of
members. This commit fixes this potential problem on our side.
Side note: even without this measure, it should not be causing any
problems for us, since we have '-fno-strict-aliasing' in our
meson.build. But in case libUV fixes their side at some point, let us
just have one less thing to worry about on our side.
Diffstat (limited to 'daemon/io.c')
-rw-r--r-- | daemon/io.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/daemon/io.c b/daemon/io.c index 1014c046..4f61a0a9 100644 --- a/daemon/io.c +++ b/daemon/io.c @@ -130,7 +130,7 @@ static int family_to_freebind_option(sa_family_t sa_family, int *level, int *nam struct pl_udp_iter_data { - PROTOLAYER_DATA_HEADER(); + struct protolayer_data h; struct proxy_result proxy; bool has_proxy; }; @@ -212,7 +212,7 @@ static enum protolayer_event_cb_result pl_udp_event_wrap( struct pl_tcp_sess_data { - PROTOLAYER_DATA_HEADER(); + struct protolayer_data h; struct proxy_result proxy; struct wire_buf wire_buf; bool had_data : 1; |