diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 22:31:29 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 22:57:00 +0800 |
commit | 5bb2c1c62a06e682ab48d530cae5f9614a90a75e (patch) | |
tree | a847e5c1980d69126b8d7974808cb70923becb33 /tests | |
parent | ba6e07cc5a0bf75118c12fd5ebf05e4453a5dc80 (diff) | |
download | gsoc2013-empathy-5bb2c1c62a06e682ab48d530cae5f9614a90a75e.tar gsoc2013-empathy-5bb2c1c62a06e682ab48d530cae5f9614a90a75e.tar.gz gsoc2013-empathy-5bb2c1c62a06e682ab48d530cae5f9614a90a75e.tar.bz2 gsoc2013-empathy-5bb2c1c62a06e682ab48d530cae5f9614a90a75e.tar.lz gsoc2013-empathy-5bb2c1c62a06e682ab48d530cae5f9614a90a75e.tar.xz gsoc2013-empathy-5bb2c1c62a06e682ab48d530cae5f9614a90a75e.tar.zst gsoc2013-empathy-5bb2c1c62a06e682ab48d530cae5f9614a90a75e.zip |
Use _unref instead of _free _destroy when possible.unref
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')
-rw-r--r-- | tests/empathy-chatroom-manager-test.c | 2 | ||||
-rw-r--r-- | tests/empathy-tls-test.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/empathy-chatroom-manager-test.c b/tests/empathy-chatroom-manager-test.c index 966027f38..3ba0239f1 100644 --- a/tests/empathy-chatroom-manager-test.c +++ b/tests/empathy-chatroom-manager-test.c @@ -76,7 +76,7 @@ check_chatrooms_list (EmpathyChatroomManager *mgr, fail_if (g_hash_table_size (found) != 0); g_list_free (chatrooms); - g_hash_table_destroy (found); + g_hash_table_unref (found); } static gboolean diff --git a/tests/empathy-tls-test.c b/tests/empathy-tls-test.c index f2b667d0b..8256da477 100644 --- a/tests/empathy-tls-test.c +++ b/tests/empathy-tls-test.c @@ -102,7 +102,7 @@ mock_tls_certificate_finalize (GObject *object) &self->rejections); g_free (self->cert_type); self->cert_type = NULL; - g_ptr_array_free (self->cert_data, TRUE); + g_ptr_array_unref (self->cert_data); self->cert_data = NULL; G_OBJECT_CLASS (mock_tls_certificate_parent_class)->finalize (object); @@ -226,7 +226,7 @@ mock_tls_certificate_assert_rejected (MockTLSCertificate *self, TP_HASH_TYPE_STRING_VARIANT_MAP, &rejection_details, NULL); g_free (rejection_error); - g_hash_table_destroy (rejection_details); + g_hash_table_unref (rejection_details); if (rejection_reason == reason) return; |