diff options
author | Thomas Haller <thaller@redhat.com> | 2018-10-22 12:53:41 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-10-23 10:47:01 +0200 |
commit | af48af4671031d3f6ff3e019c854d24402ef0d04 (patch) | |
tree | 8e6e66263cdc8b0fee0d263facd57be32e1e214e | |
parent | 56ac6308939ee826b55bcef346fdb911d6eebf47 (diff) | |
download | NetworkManager-af48af4671031d3f6ff3e019c854d24402ef0d04.tar.gz |
device: return void pointer from nm_device_get_applied_setting()
Literally ever use of nm_device_get_applied_setting() requires a
cast. Just don't.
-rw-r--r-- | libnm-core/nm-connection.c | 8 | ||||
-rw-r--r-- | src/devices/nm-device.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device.h | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index 5f406cc64a..a19a09dcd8 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -169,11 +169,15 @@ nm_connection_remove_setting (NMConnection *connection, GType setting_type) static gpointer _connection_get_setting (NMConnection *connection, GType setting_type) { + NMSetting *setting; + nm_assert (NM_IS_CONNECTION (connection)); nm_assert (g_type_is_a (setting_type, NM_TYPE_SETTING)); - return g_hash_table_lookup (NM_CONNECTION_GET_PRIVATE (connection)->settings, - g_type_name (setting_type)); + setting = g_hash_table_lookup (NM_CONNECTION_GET_PRIVATE (connection)->settings, + g_type_name (setting_type)); + nm_assert (!setting || G_TYPE_CHECK_INSTANCE_TYPE (setting, setting_type)); + return setting; } static gpointer diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 1a7b90cb57..645e8dff8a 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2418,7 +2418,7 @@ nm_device_has_unmodified_applied_connection (NMDevice *self, NMSettingCompareFla return nm_active_connection_has_unmodified_applied_connection ((NMActiveConnection *) priv->act_request.obj, compare_flags); } -NMSetting * +gpointer nm_device_get_applied_setting (NMDevice *self, GType setting_type) { NMConnection *connection; diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index bf867f4852..353bf63347 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -543,7 +543,9 @@ NMConnection * nm_device_get_settings_connection_get_connection (NMDevice *self NMConnection * nm_device_get_applied_connection (NMDevice *dev); gboolean nm_device_has_unmodified_applied_connection (NMDevice *self, NMSettingCompareFlags compare_flags); -NMSetting * nm_device_get_applied_setting (NMDevice *dev, GType setting_type); + +gpointer /* (NMSetting *) */ nm_device_get_applied_setting (NMDevice *dev, + GType setting_type); void nm_device_removed (NMDevice *self, gboolean unconfigure_ip_config); |