diff options
author | Dan Williams <dcbw@redhat.com> | 2013-11-19 15:00:21 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-12-02 15:26:12 -0600 |
commit | 983079cd5905ad7c696fae0ccc5d863ad1d4b76b (patch) | |
tree | c31904f842271d9d248473a0ccd740b6575557d6 /libnm-util/nm-setting.c | |
parent | 1b0f832c7f7c02d29b9421005c78d52ad6a47905 (diff) | |
download | NetworkManager-983079cd5905ad7c696fae0ccc5d863ad1d4b76b.tar.gz |
libnm-util: remove usage of NM_SETTING_PARAM_SERIALIZE
The only property that is not serializes is each settings' 'name'
property, so the flag serves no purpose.
Diffstat (limited to 'libnm-util/nm-setting.c')
-rw-r--r-- | libnm-util/nm-setting.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index b3db363b77..ceabc56451 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -277,7 +277,8 @@ nm_setting_to_hash (NMSetting *setting, NMSettingHashFlags flags) GParamSpec *prop_spec = property_specs[i]; GValue *value; - if (!(prop_spec->flags & NM_SETTING_PARAM_SERIALIZE)) + /* 'name' doesn't get serialized */ + if (strcmp (g_param_spec_get_name (prop_spec), NM_SETTING_NAME) == 0) continue; if ( (flags & NM_SETTING_HASH_FLAG_NO_SECRETS) @@ -352,7 +353,7 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash) GParamSpec *param_spec; param_spec = g_object_class_find_property (class, prop_name); - if (!param_spec || !(param_spec->flags & NM_SETTING_PARAM_SERIALIZE)) { + if (!param_spec) { /* Oh, we're so nice and only warn, maybe it should be a fatal error? */ g_warning ("Ignoring invalid property '%s'", prop_name); continue; @@ -1102,9 +1103,11 @@ nm_setting_to_string (NMSetting *setting) GParamSpec *prop_spec = property_specs[i]; GValue value = G_VALUE_INIT; char *value_str; - gboolean is_serializable; gboolean is_default; + if (strcmp (prop_spec->name, NM_SETTING_NAME) == 0) + continue; + g_value_init (&value, prop_spec->value_type); g_object_get_property (G_OBJECT (setting), prop_spec->name, &value); @@ -1112,22 +1115,14 @@ nm_setting_to_string (NMSetting *setting) g_string_append_printf (string, "\t%s : %s", prop_spec->name, value_str); g_free (value_str); - is_serializable = prop_spec->flags & NM_SETTING_PARAM_SERIALIZE; is_default = g_param_value_defaults (prop_spec, &value); - g_value_unset (&value); - if (is_serializable || is_default) { - g_string_append (string, " ("); - - if (is_serializable) - g_string_append_c (string, 's'); - if (is_default) - g_string_append_c (string, 'd'); - - g_string_append_c (string, ')'); - } - + g_string_append (string, " ("); + g_string_append_c (string, 's'); + if (is_default) + g_string_append_c (string, 'd'); + g_string_append_c (string, ')'); g_string_append_c (string, '\n'); } |