diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:27:27 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:27:27 +0100 |
commit | 008910a80428f2b0b8c9f5c0b55dda9b28b6c66b (patch) | |
tree | 0b87d821f1948e5b418a5a83f3a8f93229323599 | |
parent | ec9faee52bf288d811f51071e405153b1a5b5a6b (diff) |
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/
-rw-r--r-- | telepathy-yell/base-call-channel.c | 2 | ||||
-rw-r--r-- | telepathy-yell/base-call-stream.c | 4 | ||||
-rw-r--r-- | telepathy-yell/base-media-call-content.c | 2 | ||||
-rw-r--r-- | telepathy-yell/base-media-call-stream.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/telepathy-yell/base-call-channel.c b/telepathy-yell/base-call-channel.c index 5f78542..2c5e1df 100644 --- a/telepathy-yell/base-call-channel.c +++ b/telepathy-yell/base-call-channel.c @@ -221,7 +221,7 @@ tpy_base_call_channel_get_property (GObject *object, } g_value_set_boxed (value, arr); - g_ptr_array_free (arr, TRUE); + g_ptr_array_unref (arr); break; } case PROP_HARDWARE_STREAMING: diff --git a/telepathy-yell/base-call-stream.c b/telepathy-yell/base-call-stream.c index 7697a77..9215e1b 100644 --- a/telepathy-yell/base-call-stream.c +++ b/telepathy-yell/base-call-stream.c @@ -113,7 +113,7 @@ tpy_base_call_stream_finalize (GObject *object) /* free any data held directly by the object here */ g_free (priv->object_path); - g_hash_table_destroy (priv->remote_members); + g_hash_table_unref (priv->remote_members); if (G_OBJECT_CLASS (tpy_base_call_stream_parent_class)->finalize != NULL) G_OBJECT_CLASS (tpy_base_call_stream_parent_class)->finalize (object); @@ -380,7 +380,7 @@ tpy_base_call_stream_remove_member (TpyBaseCallStream *self, tpy_svc_call_stream_emit_remote_members_changed (self, empty, removed_array); g_hash_table_unref (empty); - g_array_free (removed_array, TRUE); + g_array_unref (removed_array); return TRUE; } diff --git a/telepathy-yell/base-media-call-content.c b/telepathy-yell/base-media-call-content.c index 704ab4e..2ce54f7 100644 --- a/telepathy-yell/base-media-call-content.c +++ b/telepathy-yell/base-media-call-content.c @@ -467,7 +467,7 @@ codec_offer_finished_cb (GObject *source, empty = g_array_new (FALSE, FALSE, sizeof (TpHandle)); tpy_svc_call_content_interface_media_emit_codecs_changed (self, priv->codec_map, empty); - g_array_free (empty, TRUE); + g_array_unref (empty); out: if (priv->current_offer == TPY_CALL_CONTENT_CODEC_OFFER (source)) diff --git a/telepathy-yell/base-media-call-stream.c b/telepathy-yell/base-media-call-stream.c index f49fff7..dffa212 100644 --- a/telepathy-yell/base-media-call-stream.c +++ b/telepathy-yell/base-media-call-stream.c @@ -458,7 +458,7 @@ finally: /* Note that we only do a shallow free because we've copied the contents into * local_candidates. */ if (accepted_candidates != NULL) - g_ptr_array_free (accepted_candidates, TRUE); + g_ptr_array_unref (accepted_candidates); } static void |