diff options
author | Dan Williams <dcbw@redhat.com> | 2007-09-24 04:01:24 +0000 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2007-09-24 04:01:24 +0000 |
commit | 4a7fb5f0b306dfb0f2e6977bec94cc301a68727d (patch) | |
tree | 062d85d0676aeb15865926e40b4adf90cc6be71c /libnm-util/nm-setting.c | |
parent | 7aa5d524c59ad7f23e8a160067eea39748a38c51 (diff) |
2007-09-23 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting.c
- (property_value_destroy, nm_setting_vpn_properties_new): initialize
the hash table in a standard manner. Clients of libnm-util should
only call g_hash_table_remove_all(), never destroy the hash table
and recreate it.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2859 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Diffstat (limited to 'libnm-util/nm-setting.c')
-rw-r--r-- | libnm-util/nm-setting.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index 60153f29fd..af02ea6683 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -1248,6 +1248,15 @@ setting_vpn_properties_destroy (NMSetting *setting) g_slice_free (NMSettingVPNProperties, self); } +static void +property_value_destroy (gpointer data) +{ + GValue *value = (GValue *) data; + + g_value_unset (value); + g_slice_free (GValue, data); +} + static SettingMember vpn_properties_table[] = { { "data", NM_S_TYPE_GVALUE_HASH, G_STRUCT_OFFSET (NMSettingVPNProperties, data), TRUE, FALSE }, { NULL, 0, 0 }, @@ -1257,6 +1266,7 @@ NMSetting * nm_setting_vpn_properties_new (void) { NMSetting *setting; + NMSettingVPNProperties *s_vpn_props; setting = (NMSetting *) g_slice_new0 (NMSettingVPNProperties); @@ -1266,6 +1276,11 @@ nm_setting_vpn_properties_new (void) setting->hash_fn = setting_vpn_properties_hash; setting->destroy_fn = setting_vpn_properties_destroy; + s_vpn_props = (NMSettingVPNProperties *) setting; + s_vpn_props->data = g_hash_table_new_full (g_str_hash, g_str_equal, + (GDestroyNotify) g_free, + property_value_destroy); + return setting; } |