mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 05:58:01 +02:00
shared: add _NM_GET_PRIVATE() macro
This commit is contained in:
parent
b2016fd2a5
commit
2cae9ba348
1 changed files with 18 additions and 0 deletions
|
|
@ -372,6 +372,24 @@ _notify (obj_type *obj, _PropertyEnums prop) \
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define __NM_GET_PRIVATE(self, type, is_check, result_cmd) \
|
||||||
|
({ \
|
||||||
|
/* 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 type *_self2 = (_self); \
|
||||||
|
\
|
||||||
|
nm_assert (is_check (_self)); \
|
||||||
|
( result_cmd ); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define _NM_GET_PRIVATE(self, type, is_check) __NM_GET_PRIVATE(self, type, is_check, &_self->_priv)
|
||||||
|
#define _NM_GET_PRIVATE_PTR(self, type, is_check) __NM_GET_PRIVATE(self, type, is_check, _self->_priv)
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static inline gpointer
|
static inline gpointer
|
||||||
nm_g_object_ref (gpointer obj)
|
nm_g_object_ref (gpointer obj)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue