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 | |
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/
32 files changed, 133 insertions, 133 deletions
diff --git a/lib/gibber/gibber-bytestream-direct.c b/lib/gibber/gibber-bytestream-direct.c index 3503819f..2537d32c 100644 --- a/lib/gibber/gibber-bytestream-direct.c +++ b/lib/gibber/gibber-bytestream-direct.c @@ -135,7 +135,7 @@ gibber_bytestream_direct_finalize (GObject *object) g_free (priv->peer_id); if (priv->addresses != NULL) - g_array_free (priv->addresses, TRUE); + g_array_unref (priv->addresses); G_OBJECT_CLASS (gibber_bytestream_direct_parent_class)->finalize (object); } diff --git a/lib/gibber/gibber-bytestream-muc.c b/lib/gibber/gibber-bytestream-muc.c index 0a3a11fd..a9b79ce7 100644 --- a/lib/gibber/gibber-bytestream-muc.c +++ b/lib/gibber/gibber-bytestream-muc.c @@ -128,7 +128,7 @@ gibber_bytestream_muc_dispose (GObject *object) gibber_bytestream_iface_close (GIBBER_BYTESTREAM_IFACE (self), NULL); } - g_hash_table_destroy (priv->senders); + g_hash_table_unref (priv->senders); G_OBJECT_CLASS (gibber_bytestream_muc_parent_class)->dispose (object); } diff --git a/lib/gibber/gibber-muc-connection.c b/lib/gibber/gibber-muc-connection.c index a64ba16e..39b8a27f 100644 --- a/lib/gibber/gibber-muc-connection.c +++ b/lib/gibber/gibber-muc-connection.c @@ -257,11 +257,11 @@ gibber_muc_connection_finalize (GObject *object) priv->port = NULL; if (priv->parameters != NULL) { - g_hash_table_destroy (priv->parameters); + g_hash_table_unref (priv->parameters); priv->parameters = NULL; } - g_array_free (priv->streams_used, TRUE); + g_array_unref (priv->streams_used); G_OBJECT_CLASS (gibber_muc_connection_parent_class)->finalize (object); } diff --git a/lib/gibber/gibber-r-multicast-packet.c b/lib/gibber/gibber-r-multicast-packet.c index 07954f63..5710b6dd 100644 --- a/lib/gibber/gibber-r-multicast-packet.c +++ b/lib/gibber/gibber-r-multicast-packet.c @@ -129,7 +129,7 @@ gibber_r_multicast_packet_finalize (GObject *object) gibber_r_multicast_packet_sender_info_free ( g_array_index (self->depends, GibberRMulticastPacketSenderInfo *, i)); } - g_array_free (self->depends, TRUE); + g_array_unref (self->depends); /* free any data held directly by the object here */ switch (self->type) { @@ -140,13 +140,13 @@ gibber_r_multicast_packet_finalize (GObject *object) g_free (self->data.data.payload); break; case PACKET_TYPE_ATTEMPT_JOIN: - g_array_free (self->data.attempt_join.senders, TRUE); + g_array_unref (self->data.attempt_join.senders); break; case PACKET_TYPE_JOIN: - g_array_free (self->data.join.failures, TRUE); + g_array_unref (self->data.join.failures); break; case PACKET_TYPE_FAILURE: - g_array_free (self->data.failure.failures, TRUE); + g_array_unref (self->data.failure.failures); break; default: /* Nothing specific to free */; diff --git a/lib/gibber/gibber-r-multicast-sender.c b/lib/gibber/gibber-r-multicast-sender.c index 1f3cca34..936dd87b 100644 --- a/lib/gibber/gibber-r-multicast-sender.c +++ b/lib/gibber/gibber-r-multicast-sender.c @@ -161,7 +161,7 @@ gibber_r_multicast_sender_group_free (GibberRMulticastSenderGroup *group) h = group->senders; group->senders = NULL; - g_hash_table_destroy (h); + g_hash_table_unref (h); for (i = 0; i < group->pending_removal->len ; i++) { @@ -169,7 +169,7 @@ gibber_r_multicast_sender_group_free (GibberRMulticastSenderGroup *group) g_ptr_array_index (group->pending_removal, i))); } - g_ptr_array_free (group->pending_removal, TRUE); + g_ptr_array_unref (group->pending_removal); g_queue_free (group->pop_queue); g_slice_free (GibberRMulticastSenderGroup, group); @@ -449,7 +449,7 @@ gibber_r_multicast_sender_group_gc (GibberRMulticastSenderGroup *group) gibber_r_multicast_sender_ack (sender, info->packet_id); } - g_array_free (array, TRUE); + g_array_unref (array); /* Check if we can remove pending removals */ for (i = 0; i < group->pending_removal->len ; i++) @@ -793,8 +793,8 @@ gibber_r_multicast_sender_dispose (GObject *object) priv->dispose_has_run = TRUE; - g_hash_table_destroy (priv->packet_cache); - g_hash_table_destroy (priv->acks); + g_hash_table_unref (priv->packet_cache); + g_hash_table_unref (priv->acks); if (priv->whois_timer != 0) { diff --git a/lib/gibber/gibber-r-multicast-transport.c b/lib/gibber/gibber-r-multicast-transport.c index 44516092..7c845ab9 100644 --- a/lib/gibber/gibber-r-multicast-transport.c +++ b/lib/gibber/gibber-r-multicast-transport.c @@ -299,13 +299,13 @@ gibber_r_multicast_transport_flush_state (GibberRMulticastTransport *self) if (priv->send_join != NULL) { - g_array_free (priv->send_join, TRUE); + g_array_unref (priv->send_join); priv->send_join = NULL; } if (priv->send_join_failures != NULL) { - g_array_free (priv->send_join_failures, TRUE); + g_array_unref (priv->send_join_failures); priv->send_join_failures = NULL; } @@ -351,10 +351,10 @@ gibber_r_multicast_transport_finalize (GObject *object) GibberRMulticastTransportPrivate *priv = GIBBER_R_MULTICAST_TRANSPORT_GET_PRIVATE (self); - g_hash_table_destroy (priv->members); + g_hash_table_unref (priv->members); if (priv->pending_failures != NULL) { - g_array_free (priv->pending_failures, TRUE); + g_array_unref (priv->pending_failures); priv->pending_failures = NULL; } @@ -447,7 +447,7 @@ free_member_info (gpointer data) if (info->fail_timeout != 0) g_source_remove (info->fail_timeout); - g_array_free (info->failures, TRUE); + g_array_unref (info->failures); g_slice_free (MemberInfo, info); } @@ -650,8 +650,8 @@ setup_joining_phase (GibberRMulticastTransport *self) else { g_assert (priv->state == STATE_JOINING); - g_array_free (priv->send_join, TRUE); - g_array_free (priv->send_join_failures, TRUE); + g_array_unref (priv->send_join); + g_array_unref (priv->send_join_failures); priv->send_join = g_array_new (FALSE, FALSE, sizeof (guint32)); priv->send_join_failures = g_array_new (FALSE, FALSE, sizeof (guint32)); @@ -847,7 +847,7 @@ do_send_attempt_join (gpointer user_data) { data.senders, priv->repeating_join); priv->send_empty = FALSE; } - g_array_free (data.senders, TRUE); + g_array_unref (data.senders); return FALSE; } @@ -1148,7 +1148,7 @@ recheck_failures (GibberRMulticastTransport *self) g_array_index (array, guint32, i)); } - g_array_free (array, TRUE); + g_array_unref (array); } static void @@ -1179,7 +1179,7 @@ check_failure_completion (GibberRMulticastTransport *self, guint32 id) id); g_array_append_val (lost, sender->name); g_signal_emit (self, signals[LOST_SENDERS], 0, lost); - g_array_free (lost, TRUE); + g_array_unref (lost); } gibber_r_multicast_causal_transport_remove_sender (priv->transport, id); @@ -1506,12 +1506,12 @@ check_join_agreement (GibberRMulticastTransport *self) g_free (g_array_index (lost, gchar *, i)); } - g_array_free (lost, TRUE); - g_array_free (new, TRUE); + g_array_unref (lost); + g_array_unref (new); - g_array_free (priv->send_join, TRUE); + g_array_unref (priv->send_join); priv->send_join = NULL; - g_array_free (priv->send_join_failures, TRUE); + g_array_unref (priv->send_join_failures); priv->send_join_failures = NULL; priv->state = STATE_NORMAL; diff --git a/lib/gibber/tests/test-transport.c b/lib/gibber/tests/test-transport.c index 78bd5660..b035a534 100644 --- a/lib/gibber/tests/test-transport.c +++ b/lib/gibber/tests/test-transport.c @@ -131,7 +131,7 @@ send_data (gpointer data) priv->send (GIBBER_TRANSPORT (self), (guint8 *) arr->data, arr->len, NULL, priv->user_data); - g_array_free (arr, TRUE); + g_array_unref (arr); if (g_queue_is_empty (priv->buffers)) { diff --git a/src/avahi-contact.c b/src/avahi-contact.c index b0ac4f15..b8e0769f 100644 --- a/src/avahi-contact.c +++ b/src/avahi-contact.c @@ -763,7 +763,7 @@ contact_resolved_cb (GaServiceResolver *resolver, while (olpc_key_part != NULL); salut_contact_change_olpc_key (contact, olpc_key); - g_array_free (olpc_key, TRUE); + g_array_unref (olpc_key); } /* address */ diff --git a/src/avahi-roomlist-manager.c b/src/avahi-roomlist-manager.c index df98feb6..a6416489 100644 --- a/src/avahi-roomlist-manager.c +++ b/src/avahi-roomlist-manager.c @@ -79,7 +79,7 @@ room_resolver_removed (gpointer data) { g_object_unref (g_array_index (arr, GObject *, i)); } - g_array_free (arr, TRUE); + g_array_unref (arr); } static void @@ -403,7 +403,7 @@ salut_avahi_roomlist_manager_dispose (GObject *object) if (priv->room_resolvers != NULL) { - g_hash_table_destroy (priv->room_resolvers); + g_hash_table_unref (priv->room_resolvers); priv->room_resolvers = NULL; } diff --git a/src/caps-hash.c b/src/caps-hash.c index 16489539..caa78c0f 100644 --- a/src/caps-hash.c +++ b/src/caps-hash.c @@ -72,7 +72,7 @@ caps_hash_compute_from_self_presence (SalutSelf *self) str = wocky_caps_hash_compute_from_lists (features, identities, (GPtrArray *) dataforms); - g_ptr_array_free (features, TRUE); + g_ptr_array_unref (features); wocky_disco_identity_array_free (identities); return str; diff --git a/src/connection.c b/src/connection.c index e2f5e431..4aa61a9c 100644 --- a/src/connection.c +++ b/src/connection.c @@ -662,7 +662,7 @@ set_self_presence (SalutConnection *self, base->self_handle, &ps); if (ps.optional_arguments != NULL) - g_hash_table_destroy (ps.optional_arguments); + g_hash_table_unref (ps.optional_arguments); } } @@ -1021,7 +1021,7 @@ salut_connection_finalize (GObject *object) g_free (priv->jid); #ifdef ENABLE_OLPC if (priv->olpc_key != NULL) - g_array_free (priv->olpc_key, TRUE); + g_array_unref (priv->olpc_key); g_free (priv->olpc_color); #endif g_free (priv->dnssd_name); @@ -1046,7 +1046,7 @@ _contact_manager_contact_status_changed (SalutConnection *self, &ps); if (ps.optional_arguments != NULL) - g_hash_table_destroy (ps.optional_arguments); + g_hash_table_unref (ps.optional_arguments); } static gboolean @@ -1391,7 +1391,7 @@ salut_connection_get_aliases (TpSvcConnectionInterfaceAliasing *iface, tp_svc_connection_interface_aliasing_return_from_get_aliases (context, result); - g_hash_table_destroy (result); + g_hash_table_unref (result); } static void @@ -1493,7 +1493,7 @@ conn_contact_capabilities_fill_contact_attributes (GObject *obj, } if (array != NULL) - g_ptr_array_free (array, TRUE); + g_ptr_array_unref (array); } static void @@ -1550,7 +1550,7 @@ _contact_manager_contact_alias_changed (SalutConnection *self, tp_svc_connection_interface_aliasing_emit_aliases_changed (self, aliases); g_value_unset (&entry); - g_ptr_array_free (aliases, TRUE); + g_ptr_array_unref (aliases); } static void @@ -1739,7 +1739,7 @@ salut_connection_get_known_avatar_tokens ( tp_svc_connection_interface_avatars_return_from_get_known_avatar_tokens ( context, ret); - g_hash_table_destroy (ret); + g_hash_table_unref (ret); } static void @@ -1805,7 +1805,7 @@ _request_avatars_cb (SalutContact *contact, guint8 *avatar, gsize size, (GObject *) user_data, contact->handle, contact->avatar_token, arr, ""); - g_array_free (arr, TRUE); + g_array_unref (arr); } static void @@ -1851,7 +1851,7 @@ salut_connection_request_avatars ( tp_svc_connection_interface_avatars_emit_avatar_retrieved ( (GObject *) self, base->self_handle, priv->self->avatar_token, arr, ""); - g_array_free (arr, TRUE); + g_array_unref (arr); } } else @@ -1892,7 +1892,7 @@ _request_avatar_cb (SalutContact *contact, guint8 *avatar, gsize size, arr = g_array_append_vals (arr, avatar, size); tp_svc_connection_interface_avatars_return_from_request_avatar (context, arr, ""); - g_array_free (arr, TRUE); + g_array_unref (arr); } static void @@ -2003,7 +2003,7 @@ salut_free_enhanced_contact_capabilities (GPtrArray *caps) g_value_unset (&monster); } - g_ptr_array_free (caps, TRUE); + g_ptr_array_unref (caps); } /** @@ -2052,7 +2052,7 @@ salut_connection_get_contact_capabilities ( tp_svc_connection_interface_contact_capabilities_return_from_get_contact_capabilities (context, ret); - g_hash_table_destroy (ret); + g_hash_table_unref (ret); } @@ -2070,7 +2070,7 @@ _emit_contact_capabilities_changed (SalutConnection *conn, conn, caps); salut_free_enhanced_contact_capabilities (ret); - g_hash_table_destroy (caps); + g_hash_table_unref (caps); } static void @@ -2344,7 +2344,7 @@ emit_properties_changed (SalutConnection *connection, salut_svc_olpc_buddy_info_emit_properties_changed (connection, handle, properties); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); } static void @@ -2375,7 +2375,7 @@ free_olpc_activities (GPtrArray *arr) for (i = 0; i < arr->len; i++) g_boxed_free (type, arr->pdata[i]); - g_ptr_array_free (arr, TRUE); + g_ptr_array_unref (arr); } static void @@ -2479,7 +2479,7 @@ salut_connection_olpc_get_properties (SalutSvcOLPCBuddyInfo *iface, } salut_svc_olpc_buddy_info_return_from_get_properties (context, properties); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); } @@ -2861,7 +2861,7 @@ salut_connection_olpc_set_activities (SalutSvcOLPCBuddyInfo *iface, } finally: - g_hash_table_destroy (room_to_act_id); + g_hash_table_unref (room_to_act_id); } static void @@ -2936,7 +2936,7 @@ salut_connection_act_get_properties (SalutSvcOLPCActivityProperties *iface, properties = salut_olpc_activity_create_properties_table (activity); salut_svc_olpc_buddy_info_return_from_get_properties (context, properties); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); return; @@ -3247,7 +3247,7 @@ salut_connection_olpc_observe_invitation (SalutConnection *self, g_signal_connect (muc, "closed", G_CALLBACK (muc_closed_cb), ctx); g_object_unref (muc); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); g_object_unref (inviter); } @@ -3393,7 +3393,7 @@ _olpc_activity_manager_activity_modified_cb (SalutOlpcActivityManager *mgr, salut_svc_olpc_activity_properties_emit_activity_properties_changed ( self, activity->room, properties); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); } gboolean @@ -3434,7 +3434,7 @@ salut_connection_olpc_observe_muc_stanza (SalutConnection *self, salut_olpc_activity_update (activity, room, activity_id, activity_name, activity_type, color, tags, is_private); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); return TRUE; } @@ -3649,7 +3649,7 @@ salut_connection_create_channel_managers (TpBaseConnection *base) g_object_unref (loader); g_ptr_array_foreach (tmp, add_to_array, managers); - g_ptr_array_free (tmp, TRUE); + g_ptr_array_unref (tmp); return managers; } diff --git a/src/contact-manager.c b/src/contact-manager.c index 24febddf..ec472034 100644 --- a/src/contact-manager.c +++ b/src/contact-manager.c @@ -336,7 +336,7 @@ salut_contact_manager_close_all (SalutContactManager *mgr) if (mgr->contacts) { g_hash_table_foreach_remove (mgr->contacts, dispose_contact, mgr); - g_hash_table_destroy (mgr->contacts); + g_hash_table_unref (mgr->contacts); mgr->contacts = NULL; } diff --git a/src/contact.c b/src/contact.c index 66f090af..c04c21c9 100644 --- a/src/contact.c +++ b/src/contact.c @@ -306,7 +306,7 @@ salut_contact_dispose (GObject *object) g_hash_table_foreach (priv->olpc_activities, (GHFunc) disconnect_activity_signal_foreach, self); - g_hash_table_destroy (priv->olpc_activities); + g_hash_table_unref (priv->olpc_activities); #endif salut_contact_avatar_request_flush (self, NULL, 0); @@ -350,7 +350,7 @@ salut_contact_finalize (GObject *object) #ifdef ENABLE_OLPC if (self->olpc_key != NULL) { - g_array_free (self->olpc_key, TRUE); + g_array_unref (self->olpc_key); } g_free (self->olpc_color); g_free (self->olpc_cur_act); @@ -674,7 +674,7 @@ salut_contact_change_olpc_key (SalutContact *self, GArray *olpc_key) { if (self->olpc_key != NULL) { - g_array_free (self->olpc_key, TRUE); + g_array_unref (self->olpc_key); } self->olpc_key = g_array_sized_new (FALSE, FALSE, sizeof (guint8), olpc_key->len); diff --git a/src/debug.c b/src/debug.c index 97e2e807..47fdfc7f 100644 --- a/src/debug.c +++ b/src/debug.c @@ -100,7 +100,7 @@ debug_free (void) if (flag_to_keys == NULL) return; - g_hash_table_destroy (flag_to_keys); + g_hash_table_unref (flag_to_keys); flag_to_keys = NULL; } diff --git a/src/file-transfer-channel.c b/src/file-transfer-channel.c index 52b72c0a..4dc33004 100644 --- a/src/file-transfer-channel.c +++ b/src/file-transfer-channel.c @@ -455,7 +455,7 @@ salut_file_transfer_channel_set_property (GObject *object, static void free_array (GArray *array) { - g_array_free (array, TRUE); + g_array_unref (array); } static GObject * @@ -940,7 +940,7 @@ salut_file_transfer_channel_finalize (GObject *object) g_free (self->priv->content_type); g_free (self->priv->content_hash); g_free (self->priv->description); - g_hash_table_destroy (self->priv->available_socket_types); + g_hash_table_unref (self->priv->available_socket_types); g_free (self->priv->uri); g_free (self->priv->service_name); if (self->priv->metadata != NULL) diff --git a/src/ft-manager.c b/src/ft-manager.c index f1b6bb6d..f4519b39 100644 --- a/src/ft-manager.c +++ b/src/ft-manager.c @@ -534,7 +534,7 @@ salut_ft_manager_type_foreach_channel_class (GType type, func (type, table, file_transfer_channel_allowed_properties_with_both_metadata_props, user_data); - g_hash_table_destroy (table); + g_hash_table_unref (table); } static void @@ -633,7 +633,7 @@ add_file_transfer_channel_class (GPtrArray *arr, 1, allowed_properties, G_MAXUINT); - g_hash_table_destroy (fixed_properties); + g_hash_table_unref (fixed_properties); g_ptr_array_add (arr, g_value_get_boxed (&monster)); } diff --git a/src/im-manager.c b/src/im-manager.c index 635a57cf..2460dea0 100644 --- a/src/im-manager.c +++ b/src/im-manager.c @@ -128,7 +128,7 @@ salut_im_factory_close_all (SalutImManager *self) DEBUG ("closing channels"); priv->channels = NULL; - g_hash_table_destroy (tmp); + g_hash_table_unref (tmp); } if (priv->status_changed_id != 0) @@ -371,7 +371,7 @@ salut_im_manager_type_foreach_channel_class (GType type, func (type, table, im_channel_allowed_properties, user_data); - g_hash_table_destroy (table); + g_hash_table_unref (table); } @@ -623,7 +623,7 @@ salut_im_manager_add_contact_caps (GPtrArray *arr) 1, text_allowed_properties, G_MAXUINT); - g_hash_table_destroy (fixed_properties); + g_hash_table_unref (fixed_properties); g_ptr_array_add (arr, g_value_get_boxed (&monster)); } diff --git a/src/muc-channel.c b/src/muc-channel.c index a0659666..88b593f5 100644 --- a/src/muc-channel.c +++ b/src/muc-channel.c @@ -909,7 +909,7 @@ salut_muc_channel_dispose (GObject *object) if (priv->senders != NULL) { - g_hash_table_destroy (priv->senders); + g_hash_table_unref (priv->senders); priv->senders = NULL; } @@ -971,7 +971,7 @@ salut_muc_channel_invited (SalutMucChannel *self, TpHandle inviter, g_array_append_val (members, base_connection->self_handle); r = tp_group_mixin_add_members (G_OBJECT (self), members, "", error); g_assert (r); - g_array_free (members, TRUE); + g_array_unref (members); } else { @@ -1172,8 +1172,8 @@ salut_muc_channel_received_stanza (GibberMucConnection *conn, } g_object_unref (tubes_chan); - g_ptr_array_free (tubes, TRUE); - g_hash_table_destroy (channels); + g_ptr_array_unref (tubes); + g_hash_table_unref (channels); } if (!text_helper_parse_incoming_message (stanza, &from, &msgtype, diff --git a/src/muc-manager.c b/src/muc-manager.c index a9e41438..3661bc09 100644 --- a/src/muc-manager.c +++ b/src/muc-manager.c @@ -165,14 +165,14 @@ salut_muc_manager_close_all (SalutMucManager *self) { GHashTable *tmp = priv->text_channels; priv->text_channels = NULL; - g_hash_table_destroy (tmp); + g_hash_table_unref (tmp); } if (priv->tubes_channels != NULL) { GHashTable *tmp = priv->tubes_channels; priv->tubes_channels = NULL; - g_hash_table_destroy (tmp); + g_hash_table_unref (tmp); } } @@ -385,7 +385,7 @@ salut_muc_manager_type_foreach_channel_class (GType type, func (type, table, salut_tube_dbus_channel_get_allowed_properties (), user_data); - g_hash_table_destroy (table); + g_hash_table_unref (table); } @@ -594,7 +594,7 @@ salut_muc_manager_request_new_muc_channel (SalutMucManager *mgr, connection = _get_connection (mgr, NULL, params, &connection_error); if (params != NULL) - g_hash_table_destroy (params); + g_hash_table_unref (params); if (connection == NULL) { @@ -698,7 +698,7 @@ create_tubes_channel (SalutMucManager *self, g_hash_table_insert (channels, tubes_chan, tokens); tp_channel_manager_emit_new_channels (self, channels); - g_hash_table_destroy (channels); + g_hash_table_unref (channels); g_slist_free (tokens); } @@ -763,7 +763,7 @@ handle_tube_channel_request (SalutMucManager *self, g_hash_table_insert (channels, new_channel, request_tokens); tp_channel_manager_emit_new_channels (self, channels); - g_hash_table_destroy (channels); + g_hash_table_unref (channels); g_slist_free (request_tokens); return TRUE; } @@ -1122,7 +1122,7 @@ invite_stanza_callback (WockyPorter *porter, discard: if (params_hash != NULL) - g_hash_table_destroy (params_hash); + g_hash_table_unref (params_hash); return TRUE; } diff --git a/src/olpc-activity-manager.c b/src/olpc-activity-manager.c index a4acf0aa..1ee3d87e 100644 --- a/src/olpc-activity-manager.c +++ b/src/olpc-activity-manager.c @@ -194,7 +194,7 @@ salut_olpc_activity_manager_dispose (GObject *object) { g_hash_table_foreach_remove (priv->activities_by_room, dispose_activity_foreach, self); - g_hash_table_destroy (priv->activities_by_room); + g_hash_table_unref (priv->activities_by_room); priv->activities_by_room = NULL; } diff --git a/src/olpc-activity.c b/src/olpc-activity.c index 98d33aef..141783ee 100644 --- a/src/olpc-activity.c +++ b/src/olpc-activity.c @@ -338,7 +338,7 @@ send_properties_change_msg (SalutOlpcActivity *self, g_object_unref (stanza); g_object_unref (muc_connection); g_free (muc_name); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); return result; } @@ -687,7 +687,7 @@ salut_olpc_activity_augment_invitation (SalutOlpcActivity *self, tp_handle_set_add (priv->invited, contact); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); } gboolean diff --git a/src/plugin-loader.c b/src/plugin-loader.c index 6bbb44cb..75420ab7 100644 --- a/src/plugin-loader.c +++ b/src/plugin-loader.c @@ -355,7 +355,7 @@ salut_plugin_loader_create_channel_managers ( continue; g_ptr_array_foreach (managers, copy_to_other_array, out); - g_ptr_array_free (managers, TRUE); + g_ptr_array_unref (managers); } return out; diff --git a/src/presence-cache.c b/src/presence-cache.c index 094e6774..cc3ad90b 100644 --- a/src/presence-cache.c +++ b/src/presence-cache.c @@ -256,10 +256,10 @@ salut_presence_cache_dispose (GObject *object) priv->dispose_has_run = TRUE; - g_hash_table_destroy (priv->capabilities); + g_hash_table_unref (priv->capabilities); priv->capabilities = NULL; - g_hash_table_destroy (priv->disco_pending); + g_hash_table_unref (priv->disco_pending); priv->disco_pending = NULL; tp_clear_pointer (&(priv->not_xep_capabilities.caps), diff --git a/src/roomlist-channel.c b/src/roomlist-channel.c index 362c37c9..66ca70d9 100644 --- a/src/roomlist-channel.c +++ b/src/roomlist-channel.c @@ -387,7 +387,7 @@ rooms_free (SalutRoomlistChannel *self) tp_handle_unref (room_repo, handle); } - g_ptr_array_free (priv->rooms, TRUE); + g_ptr_array_unref (priv->rooms); priv->rooms = NULL; } @@ -478,7 +478,7 @@ salut_roomlist_channel_add_room (SalutRoomlistChannel *self, 2, keys, G_MAXUINT); g_ptr_array_add (priv->rooms, g_value_get_boxed (&room)); - g_hash_table_destroy (keys); + g_hash_table_unref (keys); DEBUG ("add room %s", room_name); } diff --git a/src/roomlist-manager.c b/src/roomlist-manager.c index c299a8e4..91709586 100644 --- a/src/roomlist-manager.c +++ b/src/roomlist-manager.c @@ -313,7 +313,7 @@ salut_roomlist_manager_type_foreach_channel_class (GType type, func (type, table, roomlist_channel_allowed_properties, user_data); - g_hash_table_destroy (table); + g_hash_table_unref (table); } @@ -236,7 +236,7 @@ salut_self_set_property (GObject *object, if (arr != NULL) { if (self->olpc_key != NULL) - g_array_free (self->olpc_key, TRUE); + g_array_unref (self->olpc_key); self->olpc_key = g_array_sized_new (FALSE, FALSE, sizeof (guint8), arr->len); @@ -473,7 +473,7 @@ salut_self_dispose (GObject *object) } if (priv->olpc_activities != NULL) - g_hash_table_destroy (priv->olpc_activities); + g_hash_table_unref (priv->olpc_activities); if (self->olpc_cur_act_room != 0) { @@ -519,7 +519,7 @@ salut_self_finalize (GObject *object) g_free (self->alias); #ifdef ENABLE_OLPC if (self->olpc_key != NULL) - g_array_free (self->olpc_key, TRUE); + g_array_unref (self->olpc_key); g_free (self->olpc_color); g_free (self->olpc_cur_act); #endif diff --git a/src/tube-dbus.c b/src/tube-dbus.c index 6513e090..6ed2dec9 100644 --- a/src/tube-dbus.c +++ b/src/tube-dbus.c @@ -626,7 +626,7 @@ salut_tube_dbus_dispose (GObject *object) { g_hash_table_foreach (priv->dbus_names, unref_handle_foreach, contact_repo); - g_hash_table_destroy (priv->dbus_names); + g_hash_table_unref (priv->dbus_names); } if (priv->muc_connection != NULL) @@ -655,8 +655,8 @@ salut_tube_dbus_finalize (GObject *object) g_free (priv->object_path); g_free (priv->stream_id); g_free (priv->service); - g_hash_table_destroy (priv->parameters); - g_array_free (priv->supported_access_controls, TRUE); + g_hash_table_unref (priv->parameters); + g_array_unref (priv->supported_access_controls); G_OBJECT_CLASS (salut_tube_dbus_parent_class)->finalize (object); } @@ -886,7 +886,7 @@ salut_tube_dbus_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; default: @@ -1617,8 +1617,8 @@ salut_tube_dbus_add_name (SalutTubeDBus *self, tp_svc_channel_type_dbus_tube_emit_dbus_names_changed (self, added, removed); - g_hash_table_destroy (added); - g_array_free (removed, TRUE); + g_hash_table_unref (added); + g_array_unref (removed); return TRUE; } @@ -1651,8 +1651,8 @@ salut_tube_dbus_remove_name (SalutTubeDBus *self, tp_svc_channel_type_dbus_tube_emit_dbus_names_changed (self, added, removed); - g_hash_table_destroy (added); - g_array_free (removed, TRUE); + g_hash_table_unref (added); + g_array_unref (removed); tp_handle_unref (contact_repo, handle); return TRUE; } 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 * diff --git a/src/tubes-channel.c b/src/tubes-channel.c index 54cad47f..9982719e 100644 --- a/src/tubes-channel.c +++ b/src/tubes-channel.c @@ -423,8 +423,8 @@ d_bus_names_changed_added (SalutTubesChannel *self, for (i = 0; i < added->len; i++) g_boxed_free (DBUS_NAME_PAIR_TYPE, added->pdata[i]); - g_ptr_array_free (added, TRUE); - g_array_free (removed, TRUE); + g_ptr_array_unref (added); + g_array_unref (removed); } static void @@ -447,8 +447,8 @@ d_bus_names_changed_removed (SalutTubesChannel *self, tp_svc_channel_type_tubes_emit_d_bus_names_changed (self, tube_id, added, removed); - g_ptr_array_free (added, TRUE); - g_array_free (removed, TRUE); + g_ptr_array_unref (added); + g_array_unref (removed); } static void @@ -523,7 +523,7 @@ salut_tubes_channel_get_available_tube_types (TpSvcChannelTypeTubes *iface, tp_svc_channel_type_tubes_return_from_get_available_tube_types (context, ret); - g_array_free (ret, TRUE); + g_array_unref (ret); } struct _add_in_old_dbus_tubes_data @@ -711,7 +711,7 @@ salut_tubes_channel_muc_message_received (SalutTubesChannel *self, /* the tube has reffed its initiator, no need to keep a ref */ tp_handle_unref (contact_repo, initiator_handle); - g_hash_table_destroy (parameters); + g_hash_table_unref (parameters); } } else @@ -775,7 +775,7 @@ salut_tubes_channel_muc_message_received (SalutTubesChannel *self, g_hash_table_foreach (old_dbus_tubes, emit_d_bus_names_changed_foreach, &emit_data); - g_hash_table_destroy (old_dbus_tubes); + g_hash_table_unref (old_dbus_tubes); return result; } @@ -887,7 +887,7 @@ salut_tubes_channel_tube_request (SalutTubesChannel *self, tube = create_new_tube (self, type, priv->self_handle, FALSE, service, parameters, tube_id, 0, NULL); - g_hash_table_destroy (parameters); + g_hash_table_unref (parameters); return tube; } @@ -940,7 +940,7 @@ muc_connection_lost_senders_cb (GibberMucConnection *conn, g_hash_table_foreach (old_dbus_tubes, emit_d_bus_names_changed_foreach, &emit_data); - g_hash_table_destroy (old_dbus_tubes); + g_hash_table_unref (old_dbus_tubes); } } @@ -1022,7 +1022,7 @@ salut_tubes_channel_list_tubes (TpSvcChannelTypeTubes *iface, for (i = 0; i < ret->len; i++) g_boxed_free (SALUT_CHANNEL_TUBE_TYPE, ret->pdata[i]); - g_ptr_array_free (ret, TRUE); + g_ptr_array_unref (ret); } static void @@ -1128,7 +1128,7 @@ tube_offered_cb (SalutTubeIface *tube, update_tubes_info (self); g_free (service); - g_hash_table_destroy (parameters); + g_hash_table_unref (parameters); } static SalutTubeIface * @@ -1749,7 +1749,7 @@ salut_tubes_channel_get_d_bus_names (TpSvcChannelTypeTubes *iface, for (i = 0; i < ret->len; i++) g_boxed_free (DBUS_NAME_PAIR_TYPE, ret->pdata[i]); g_hash_table_unref (names); - g_ptr_array_free (ret, TRUE); + g_ptr_array_unref (ret); } static void @@ -2185,7 +2185,7 @@ salut_tubes_channel_get_available_stream_tube_types ( tp_svc_channel_type_tubes_return_from_get_available_stream_tube_types ( context, ret); - g_hash_table_destroy (ret); + g_hash_table_unref (ret); } static void salut_tubes_channel_dispose (GObject *object); @@ -2402,7 +2402,7 @@ salut_tubes_channel_close (SalutTubesChannel *self) priv->closed = TRUE; g_hash_table_foreach (priv->tubes, emit_tube_closed_signal, self); - g_hash_table_destroy (priv->tubes); + g_hash_table_unref (priv->tubes); priv->tubes = NULL; diff --git a/src/tubes-manager.c b/src/tubes-manager.c index 12385f6e..64351ece 100644 --- a/src/tubes-manager.c +++ b/src/tubes-manager.c @@ -352,7 +352,7 @@ iq_tube_request_cb (WockyPorter *porter, { DEBUG ("couldn't make new tubes channel: %s", e->message); g_error_free (e); - g_hash_table_destroy (parameters); + g_hash_table_unref (parameters); return TRUE; } @@ -372,7 +372,7 @@ iq_tube_request_cb (WockyPorter *porter, initiator_handle)); } - g_hash_table_destroy (parameters); + g_hash_table_unref (parameters); return TRUE; } @@ -387,8 +387,8 @@ iq_tube_request_cb (WockyPorter *porter, tp_channel_manager_emit_new_channels (self, channels); - g_hash_table_destroy (parameters); - g_hash_table_destroy (channels); + g_hash_table_unref (parameters); + g_hash_table_unref (channels); } return TRUE; @@ -414,7 +414,7 @@ salut_tubes_manager_close_all (SalutTubesManager *self) tmp = priv->tubes_channels; priv->tubes_channels = NULL; - g_hash_table_destroy (tmp); + g_hash_table_unref (tmp); } } @@ -746,7 +746,7 @@ salut_tubes_manager_type_foreach_channel_class (GType type, func (type, table, old_tubes_channel_allowed_properties, user_data); - g_hash_table_destroy (table); + g_hash_table_unref (table); /* 1-1 Channel.Type.StreamTube */ table = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, @@ -765,7 +765,7 @@ salut_tubes_manager_type_foreach_channel_class (GType type, func (type, table, salut_tube_stream_channel_get_allowed_properties (), user_data); - g_hash_table_destroy (table); + g_hash_table_unref (table); /* 1-1 Channel.Type.DBusTube */ /* Temporarily disabled since the implementation is incomplete. */ @@ -785,7 +785,7 @@ salut_tubes_manager_type_foreach_channel_class (GType type, func (type, table, dbus_tube_channel_allowed_properties, user_data); - g_hash_table_destroy (table); + g_hash_table_unref (table); #endif } @@ -958,7 +958,7 @@ salut_tubes_manager_requestotron (SalutTubesManager *self, tp_channel_manager_emit_new_channels (self, channels); - g_hash_table_destroy (channels); + g_hash_table_unref (channels); g_slist_free (tokens); return TRUE; } @@ -1076,7 +1076,7 @@ add_service_to_array (const gchar *service, 1, tube_allowed_properties, G_MAXUINT); - g_hash_table_destroy (fixed_properties); + g_hash_table_unref (fixed_properties); g_ptr_array_add (arr, g_value_get_boxed (&monster)); } @@ -1115,7 +1115,7 @@ add_generic_tube_caps (GPtrArray *arr) 1, stream_tube_channel_allowed_properties, G_MAXUINT); - g_hash_table_destroy (fixed_properties); + g_hash_table_unref (fixed_properties); g_ptr_array_add (arr, g_value_get_boxed (&monster1)); /* FIXME: enable once D-Bus tube new API are implemented */ @@ -1146,7 +1146,7 @@ add_generic_tube_caps (GPtrArray *arr) 1, gabble_tube_dbus_channel_get_allowed_properties (), G_MAXUINT); - g_hash_table_destroy (fixed_properties); + g_hash_table_unref (fixed_properties); g_ptr_array_add (arr, g_value_get_boxed (&monster2)); #endif } diff --git a/src/write-mgr-file.c b/src/write-mgr-file.c index 71adefeb..7ef6e699 100644 --- a/src/write-mgr-file.c +++ b/src/write-mgr-file.c @@ -315,7 +315,7 @@ mgr_file_contents (const char *busname, WRITE_STR (TP_PROP_PROTOCOL_ICON, "Icon"); g_free (section_name); - g_hash_table_destroy (props); + g_hash_table_unref (props); protocols = protocols->next; } diff --git a/tests/check-node-properties.c b/tests/check-node-properties.c index e55b8846..755872bb 100644 --- a/tests/check-node-properties.c +++ b/tests/check-node-properties.c @@ -133,7 +133,7 @@ test_extract_properties (void) g_assert (prop5_value == TRUE); g_object_unref (stanza); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); } static void @@ -237,7 +237,7 @@ test_add_children_from_properties (void) g_assert_not_reached (); } - g_hash_table_destroy (properties); + g_hash_table_unref (properties); g_object_unref (stanza); } |