summaryrefslogtreecommitdiff
path: root/libnm-core
diff options
context:
space:
mode:
authorAntonio Cardace <acardace@redhat.com>2020-03-25 11:04:09 +0100
committerAntonio Cardace <acardace@redhat.com>2020-04-06 09:56:07 +0200
commitd5538efb316eeda45749dfc8ccd6e850316a8540 (patch)
tree7275454e1d46884e1bc545aef78abc6bde46af90 /libnm-core
parent3670aa9bcd182505be1b88c055661ff06e4338e4 (diff)
downloadNetworkManager-d5538efb316eeda45749dfc8ccd6e850316a8540.tar.gz
nm-setting-bridge: hide GObject structs from public API and embed private data
Hide the object and class structures from public API. This is an API and ABI break, but of something that is very likely unused. This is mainly done to embed the private structure in the object itself. This has benefits for performance and debugability.
Diffstat (limited to 'libnm-core')
-rw-r--r--libnm-core/nm-setting-bridge.c18
-rw-r--r--libnm-core/nm-setting-bridge.h16
2 files changed, 16 insertions, 18 deletions
diff --git a/libnm-core/nm-setting-bridge.c b/libnm-core/nm-setting-bridge.c
index 9c22ac0f7e..62538cff8d 100644
--- a/libnm-core/nm-setting-bridge.c
+++ b/libnm-core/nm-setting-bridge.c
@@ -63,9 +63,23 @@ typedef struct {
bool stp:1;
} NMSettingBridgePrivate;
+/**
+ * NMSettingBridge:
+ *
+ * Bridging Settings
+ */
+struct _NMSettingBridge {
+ NMSetting parent;
+ NMSettingBridgePrivate _priv;
+};
+
+struct _NMSettingBridgeClass {
+ NMSettingClass parent;
+};
+
G_DEFINE_TYPE (NMSettingBridge, nm_setting_bridge, NM_TYPE_SETTING)
-#define NM_SETTING_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_BRIDGE, NMSettingBridgePrivate))
+#define NM_SETTING_BRIDGE_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSettingBridge, NM_IS_SETTING_BRIDGE, NMSetting)
/*****************************************************************************/
@@ -1182,8 +1196,6 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *klass)
NMSettingClass *setting_class = NM_SETTING_CLASS (klass);
GArray *properties_override = _nm_sett_info_property_override_create_array ();
- g_type_class_add_private (klass, sizeof (NMSettingBridgePrivate));
-
object_class->get_property = get_property;
object_class->set_property = set_property;
object_class->finalize = finalize;
diff --git a/libnm-core/nm-setting-bridge.h b/libnm-core/nm-setting-bridge.h
index ee8b45f617..36ac9a5300 100644
--- a/libnm-core/nm-setting-bridge.h
+++ b/libnm-core/nm-setting-bridge.h
@@ -39,21 +39,7 @@ G_BEGIN_DECLS
#define NM_BRIDGE_VLAN_VID_MIN 1
#define NM_BRIDGE_VLAN_VID_MAX 4094
-/**
- * NMSettingBridge:
- *
- * Bridging Settings
- */
-struct _NMSettingBridge {
- NMSetting parent;
-};
-
-typedef struct {
- NMSettingClass parent;
-
- /*< private >*/
- gpointer padding[4];
-} NMSettingBridgeClass;
+typedef struct _NMSettingBridgeClass NMSettingBridgeClass;
typedef struct _NMBridgeVlan NMBridgeVlan;