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 /telepathy-glib/contacts-mixin.c | |
parent | e6d8b4c7531688cd2dbd3c9bbd8a6c224123de05 (diff) | |
download | telepathy-glib-67bffca0678d1286d07b1531f6562126e92cc31e.tar.gz |
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 'telepathy-glib/contacts-mixin.c')
-rw-r--r-- | telepathy-glib/contacts-mixin.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/telepathy-glib/contacts-mixin.c b/telepathy-glib/contacts-mixin.c index 12fc25a0e..29b1431e7 100644 --- a/telepathy-glib/contacts-mixin.c +++ b/telepathy-glib/contacts-mixin.c @@ -258,7 +258,7 @@ tp_contacts_mixin_finalize (GObject *obj) DEBUG ("%p", obj); /* free any data held directly by the object here */ - g_hash_table_destroy (mixin->priv->interfaces); + g_hash_table_unref (mixin->priv->interfaces); g_slice_free (TpContactsMixinPrivate, mixin->priv); } @@ -308,7 +308,7 @@ tp_contacts_mixin_get_contact_attributes (GObject *obj, valid_handles = g_array_sized_new (TRUE, TRUE, sizeof (TpHandle), handles->len); result = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, - (GDestroyNotify) g_hash_table_destroy); + (GDestroyNotify) g_hash_table_unref); for (i = 0 ; i < handles->len ; i++) { @@ -353,7 +353,7 @@ tp_contacts_mixin_get_contact_attributes (GObject *obj, } tp_handles_unref (contact_repo, valid_handles); - g_array_free (valid_handles, TRUE); + g_array_unref (valid_handles); return result; } @@ -386,7 +386,7 @@ tp_contacts_mixin_get_contact_attributes_impl ( context, result); g_free (sender); - g_hash_table_destroy (result); + g_hash_table_unref (result); } /** |