mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-23 03:50:08 +01:00
core: improve implementation of NM_DEVICE_DEFINE_LINK_TYPES() macro
I think it's technically not correct to rely on the "sentinal" field being immediately after the previous field, due to alignment. Implement the macro differently.
This commit is contained in:
parent
0cb0ee0482
commit
86787e0278
1 changed files with 6 additions and 7 deletions
|
|
@ -180,15 +180,14 @@ void nm_device_commit_mtu (NMDevice *self);
|
|||
((NM_NARG (__VA_ARGS__) == 0) \
|
||||
? NULL \
|
||||
: ({ \
|
||||
static const struct { \
|
||||
const NMLinkType types[NM_NARG (__VA_ARGS__)]; \
|
||||
const NMLinkType sentinel; \
|
||||
} _link_types = { \
|
||||
.types = { __VA_ARGS__ }, \
|
||||
.sentinel = NM_LINK_TYPE_NONE, \
|
||||
const NMLinkType _types[NM_NARG (__VA_ARGS__) + 1] = { \
|
||||
__VA_ARGS__ \
|
||||
_NM_MACRO_COMMA_IF_ARGS (__VA_ARGS__) \
|
||||
NM_LINK_TYPE_NONE, \
|
||||
}; \
|
||||
\
|
||||
_link_types.types; \
|
||||
nm_assert (_types[NM_NARG (__VA_ARGS__)] == NM_LINK_TYPE_NONE); \
|
||||
_types; \
|
||||
})\
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue