mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-15 15:20:52 +01:00
device: assertion object in NM_DEVICE_GET_PRIVATE()
This commit is contained in:
parent
51791c4772
commit
adbba0fb39
1 changed files with 12 additions and 1 deletions
|
|
@ -72,7 +72,18 @@ _LOG_DECLARE_SELF (NMDevice);
|
|||
|
||||
G_DEFINE_ABSTRACT_TYPE (NMDevice, nm_device, NM_TYPE_EXPORTED_OBJECT)
|
||||
|
||||
#define NM_DEVICE_GET_PRIVATE(o) ((o)->priv)
|
||||
#define NM_DEVICE_GET_PRIVATE(o) \
|
||||
({ \
|
||||
/* preserve the const-ness of self. Unfortunately, that
|
||||
* way, @self cannot be a void pointer */ \
|
||||
typeof (self) _self = (self); \
|
||||
\
|
||||
/* Get compiler error if variable is of wrong type */ \
|
||||
_nm_unused const NMDevice *_self2 = (_self); \
|
||||
\
|
||||
nm_assert (NM_IS_DEVICE (_self)); \
|
||||
_self->priv; \
|
||||
})
|
||||
|
||||
enum {
|
||||
STATE_CHANGED,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue