diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 14:08:45 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 14:36:51 +0100 |
commit | 67bffca0678d1286d07b1531f6562126e92cc31e (patch) | |
tree | 309fa93328b63d8c1a90432bc1c697b4a97beba0 /tests/lib/contacts-conn.c | |
parent | e6d8b4c7531688cd2dbd3c9bbd8a6c224123de05 (diff) |
Use _unref instead of _free _destroy when possible.
Replace g_(ptr_)array_free (foo, TRUE) and g_hash_table_destroy
with respectively g_(ptr_)array_unref (foo) and g_hash_table_unref.
I used this command to generate this patch:
for f in `find -name "*.c"`; do sed -i $f -re 's/g_ptr_array_free \(([^ ,]+), TRUE\)/g_ptr_array_unref \(\1\)/'; done
See Danielle's blog for explanation of possible bug _free can do:
http://blogs.gnome.org/danni/2011/11/16/mistakes-with-g_value_set_boxed/
Diffstat (limited to 'tests/lib/contacts-conn.c')
-rw-r--r-- | tests/lib/contacts-conn.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/lib/contacts-conn.c b/tests/lib/contacts-conn.c index 1d1b5ee1c..8c187ffd1 100644 --- a/tests/lib/contacts-conn.c +++ b/tests/lib/contacts-conn.c @@ -169,13 +169,13 @@ finalize (GObject *object) TpTestsContactsConnection *self = TP_TESTS_CONTACTS_CONNECTION (object); tp_contacts_mixin_finalize (object); - g_hash_table_destroy (self->priv->aliases); - g_hash_table_destroy (self->priv->avatars); - g_hash_table_destroy (self->priv->presence_statuses); - g_hash_table_destroy (self->priv->presence_messages); - g_hash_table_destroy (self->priv->locations); - g_hash_table_destroy (self->priv->capabilities); - g_hash_table_destroy (self->priv->contact_info); + g_hash_table_unref (self->priv->aliases); + g_hash_table_unref (self->priv->avatars); + g_hash_table_unref (self->priv->presence_statuses); + g_hash_table_unref (self->priv->presence_messages); + g_hash_table_unref (self->priv->locations); + g_hash_table_unref (self->priv->capabilities); + g_hash_table_unref (self->priv->contact_info); if (self->priv->default_contact_info != NULL) g_ptr_array_unref (self->priv->default_contact_info); @@ -460,7 +460,7 @@ my_get_contact_statuses (GObject *object, g_hash_table_insert (result, key, tp_presence_status_new (index, parameters)); - g_hash_table_destroy (parameters); + g_hash_table_unref (parameters); } return result; @@ -611,7 +611,7 @@ tp_tests_contacts_connection_change_aliases (TpTestsContactsConnection *self, structs); g_ptr_array_foreach (structs, (GFunc) g_value_array_free, NULL); - g_ptr_array_free (structs, TRUE); + g_ptr_array_unref (structs); } void @@ -648,12 +648,12 @@ tp_tests_contacts_connection_change_presences ( g_hash_table_insert (presences, key, tp_presence_status_new (indexes[i], parameters)); - g_hash_table_destroy (parameters); + g_hash_table_unref (parameters); } tp_presence_mixin_emit_presence_update ((GObject *) self, presences); - g_hash_table_destroy (presences); + g_hash_table_unref (presences); } void @@ -804,7 +804,7 @@ my_get_aliases (TpSvcConnectionInterfaceAliasing *aliasing, tp_svc_connection_interface_aliasing_return_from_get_aliases (context, result); - g_hash_table_destroy (result); + g_hash_table_unref (result); } static void @@ -915,7 +915,7 @@ my_get_avatar_tokens (TpSvcConnectionInterfaceAvatars *avatars, tp_svc_connection_interface_avatars_return_from_get_known_avatar_tokens ( context, result); - g_hash_table_destroy (result); + g_hash_table_unref (result); } static void @@ -955,7 +955,7 @@ my_get_known_avatar_tokens (TpSvcConnectionInterfaceAvatars *avatars, tp_svc_connection_interface_avatars_return_from_get_known_avatar_tokens ( context, result); - g_hash_table_destroy (result); + g_hash_table_unref (result); } static void @@ -1069,7 +1069,7 @@ my_get_locations (TpSvcConnectionInterfaceLocation *avatars, tp_svc_connection_interface_location_return_from_get_locations ( context, result); - g_hash_table_destroy (result); + g_hash_table_unref (result); } static void @@ -1123,7 +1123,7 @@ my_get_contact_capabilities (TpSvcConnectionInterfaceContactCapabilities *obj, tp_svc_connection_interface_contact_capabilities_return_from_get_contact_capabilities ( context, result); - g_hash_table_destroy (result); + g_hash_table_unref (result); } static void |