summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-09-27 13:04:47 +0200
committerThomas Haller <thaller@redhat.com>2022-10-03 17:54:57 +0200
commitd75bfd3a3dae290c4a179ae797aa0ab7a9f06f2e (patch)
treede45a8acd3abb17e5c7bebc29d28435c8b1c66f1
parent28cb40705638435df62e07d8e7c210f47c21efb3 (diff)
downloadNetworkManager-d75bfd3a3dae290c4a179ae797aa0ab7a9f06f2e.tar.gz
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".
-rw-r--r--src/libnm-core-impl/nm-connection.c27
-rw-r--r--src/libnm-core-impl/nm-setting-private.h26
2 files changed, 26 insertions, 27 deletions
diff --git a/src/libnm-core-impl/nm-connection.c b/src/libnm-core-impl/nm-connection.c
index eabb3a6996..60e7eb7ff2 100644
--- a/src/libnm-core-impl/nm-connection.c
+++ b/src/libnm-core-impl/nm-connection.c
@@ -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)
{
diff --git a/src/libnm-core-impl/nm-setting-private.h b/src/libnm-core-impl/nm-setting-private.h
index 01d3113cde..005d04808a 100644
--- a/src/libnm-core-impl/nm-setting-private.h
+++ b/src/libnm-core-impl/nm-setting-private.h
@@ -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); \