mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 09:30:31 +01:00
libnm: move optimized NM_IS_{SIMPLE,}CONNECTION() to internal header
We already redefine those checks to optimize for NMSimpleConnection. Which, in particular when libnm-core is used by the daemon, is the only implementation of the NMConnection interface. Move those to the private header file. No need to keep it private to "nm-connection.c".
This commit is contained in:
parent
28cb407056
commit
d75bfd3a3d
2 changed files with 26 additions and 27 deletions
|
|
@ -54,33 +54,6 @@ static gboolean _nm_connection_clear_settings(NMConnection *connection, NMConnec
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#undef NM_IS_SIMPLE_CONNECTION
|
||||
#define NM_IS_SIMPLE_CONNECTION(self) \
|
||||
({ \
|
||||
gconstpointer _self1 = (self); \
|
||||
gboolean _result; \
|
||||
\
|
||||
_result = \
|
||||
(_self1 \
|
||||
&& (((GTypeInstance *) _self1)->g_class == _nm_simple_connection_class_instance)); \
|
||||
\
|
||||
nm_assert(_result == G_TYPE_CHECK_INSTANCE_TYPE(_self1, NM_TYPE_SIMPLE_CONNECTION)); \
|
||||
\
|
||||
_result; \
|
||||
})
|
||||
|
||||
#undef NM_IS_CONNECTION
|
||||
#define NM_IS_CONNECTION(self) \
|
||||
({ \
|
||||
gconstpointer _self0 = (self); \
|
||||
\
|
||||
(_self0 \
|
||||
&& (NM_IS_SIMPLE_CONNECTION(_self0) \
|
||||
|| G_TYPE_CHECK_INSTANCE_TYPE(_self0, NM_TYPE_CONNECTION))); \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
_nm_connection_private_clear(NMConnectionPrivate *priv)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "nm-setting.h"
|
||||
#include "nm-setting-bridge.h"
|
||||
#include "nm-connection.h"
|
||||
#include "nm-simple-connection.h"
|
||||
#include "nm-core-enum-types.h"
|
||||
|
||||
#include "libnm-core-intern/nm-core-internal.h"
|
||||
|
|
@ -31,6 +32,31 @@ typedef struct {
|
|||
extern GTypeClass *_nm_simple_connection_class_instance;
|
||||
extern int _nm_simple_connection_private_offset;
|
||||
|
||||
#undef NM_IS_SIMPLE_CONNECTION
|
||||
#define NM_IS_SIMPLE_CONNECTION(self) \
|
||||
({ \
|
||||
gconstpointer _self1 = (self); \
|
||||
gboolean _result; \
|
||||
\
|
||||
_result = \
|
||||
(_self1 \
|
||||
&& (((GTypeInstance *) _self1)->g_class == _nm_simple_connection_class_instance)); \
|
||||
\
|
||||
nm_assert(_result == G_TYPE_CHECK_INSTANCE_TYPE(_self1, NM_TYPE_SIMPLE_CONNECTION)); \
|
||||
\
|
||||
_result; \
|
||||
})
|
||||
|
||||
#undef NM_IS_CONNECTION
|
||||
#define NM_IS_CONNECTION(self) \
|
||||
({ \
|
||||
gconstpointer _self0 = (self); \
|
||||
\
|
||||
(_self0 \
|
||||
&& (NM_IS_SIMPLE_CONNECTION(_self0) \
|
||||
|| G_TYPE_CHECK_INSTANCE_TYPE(_self0, NM_TYPE_CONNECTION))); \
|
||||
})
|
||||
|
||||
#define _NM_SIMPLE_CONNECTION_GET_CONNECTION_PRIVATE(connection) \
|
||||
({ \
|
||||
gpointer _connection_1 = (connection); \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue