diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:35:10 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:35:31 +0100 |
commit | b7cfa229c65ecba4d4a5e9e0ea90331e9d5bb269 (patch) | |
tree | 8ea475c882ba20c8b42bcc7348c361e8b55ceb54 /src/tube-stream.c | |
parent | 54f726c81670463a8bf16b4cd002d258f03aa05a (diff) | |
download | telepathy-salut-b7cfa229c65ecba4d4a5e9e0ea90331e9d5bb269.tar.gz |
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 'src/tube-stream.c')
-rw-r--r-- | src/tube-stream.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tube-stream.c b/src/tube-stream.c index 4e310cd5..64f56137 100644 --- a/src/tube-stream.c +++ b/src/tube-stream.c @@ -861,7 +861,7 @@ tube_stream_open (SalutTubeStream *self, priv->address = tp_g_value_slice_new (DBUS_TYPE_G_UCHAR_ARRAY); g_value_set_boxed (priv->address, array); - g_array_free (array, TRUE); + g_array_unref (array); ret = gibber_listener_listen_socket (priv->local_listener, path, FALSE, error); @@ -1028,19 +1028,19 @@ salut_tube_stream_dispose (GObject *object) if (priv->transport_to_bytestream != NULL) { - g_hash_table_destroy (priv->transport_to_bytestream); + g_hash_table_unref (priv->transport_to_bytestream); priv->transport_to_bytestream = NULL; } if (priv->bytestream_to_transport != NULL) { - g_hash_table_destroy (priv->bytestream_to_transport); + g_hash_table_unref (priv->bytestream_to_transport); priv->bytestream_to_transport = NULL; } if (priv->transport_to_id != NULL) { - g_hash_table_destroy (priv->transport_to_id); + g_hash_table_unref (priv->transport_to_id); priv->transport_to_id = NULL; } @@ -1074,7 +1074,7 @@ salut_tube_stream_finalize (GObject *object) g_free (priv->service); if (priv->parameters != NULL) { - g_hash_table_destroy (priv->parameters); + g_hash_table_unref (priv->parameters); priv->parameters = NULL; } @@ -1299,7 +1299,7 @@ salut_tube_stream_set_property (GObject *object, break; case PROP_PARAMETERS: if (priv->parameters != NULL) - g_hash_table_destroy (priv->parameters); + g_hash_table_unref (priv->parameters); priv->parameters = g_value_dup_boxed (value); break; case PROP_OFFERED: @@ -2392,7 +2392,7 @@ static void destroy_socket_control_list (gpointer data) { GArray *tab = data; - g_array_free (tab, TRUE); + g_array_unref (tab); } GHashTable * |