diff options
author | Dan Winship <danw@redhat.com> | 2015-01-15 11:09:00 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-15 14:46:30 -0500 |
commit | d80e100179d408a754402d1c688052cd45bf7bfa (patch) | |
tree | 07c9e49df494947887ae3de7dd8cbf6aa2275d3d | |
parent | bbbbca27787079ab028664f49f7bd1f3a3cad626 (diff) | |
download | NetworkManager-d80e100179d408a754402d1c688052cd45bf7bfa.tar.gz |
libnm-core: simplify _nm_setting_new_from_dbus()
libnm-util's nm_setting_new_from_hash() needed to call
g_type_class_ref(setting_type) to ensure that the class had been
initialized by the time we fetched its properties. But in libnm-core's
version, we create the setting object before fetching the list of
properties, so we know the class will already have been initialized by
that point.
-rw-r--r-- | libnm-core/nm-setting.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index 48317fc7c6..4ecfb02494 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -766,7 +766,6 @@ _nm_setting_new_from_dbus (GType setting_type, GVariant *connection_dict, GError **error) { - NMSettingClass *class; NMSetting *setting; const NMSettingProperty *properties; guint n_properties; @@ -781,11 +780,6 @@ _nm_setting_new_from_dbus (GType setting_type, if (connection_dict) g_return_val_if_fail (g_variant_is_of_type (connection_dict, NM_VARIANT_TYPE_CONNECTION), NULL); - /* g_type_class_ref() ensures the setting class is created if it hasn't - * already been used. - */ - class = g_type_class_ref (setting_type); - /* Build the setting object from the properties we know about; we assume * that any propreties in @setting_dict that we don't know about can * either be ignored or else has a backward-compatibility equivalent @@ -793,7 +787,7 @@ _nm_setting_new_from_dbus (GType setting_type, */ setting = (NMSetting *) g_object_new (setting_type, NULL); - properties = nm_setting_class_get_properties (class, &n_properties); + properties = nm_setting_class_get_properties (NM_SETTING_GET_CLASS (setting), &n_properties); for (i = 0; i < n_properties; i++) { const NMSettingProperty *property = &properties[i]; GVariant *value; @@ -825,8 +819,6 @@ _nm_setting_new_from_dbus (GType setting_type, g_variant_unref (value); } - g_type_class_unref (class); - return setting; } |