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) \
|
((NM_NARG (__VA_ARGS__) == 0) \
|
||||||
? NULL \
|
? NULL \
|
||||||
: ({ \
|
: ({ \
|
||||||
static const struct { \
|
const NMLinkType _types[NM_NARG (__VA_ARGS__) + 1] = { \
|
||||||
const NMLinkType types[NM_NARG (__VA_ARGS__)]; \
|
__VA_ARGS__ \
|
||||||
const NMLinkType sentinel; \
|
_NM_MACRO_COMMA_IF_ARGS (__VA_ARGS__) \
|
||||||
} _link_types = { \
|
NM_LINK_TYPE_NONE, \
|
||||||
.types = { __VA_ARGS__ }, \
|
|
||||||
.sentinel = 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