diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 14:39:30 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:56:47 +0100 |
commit | 769a97c2ed9e6cbfda656a65483f6142423adc36 (patch) | |
tree | 2fd5a84dd6c4a41d4e4e61d37780d65a630fa72f /src/conn-olpc.c | |
parent | dfccd984ac6c694a689c1f224efb4f4e2b27e01c (diff) | |
download | telepathy-gabble-769a97c2ed9e6cbfda656a65483f6142423adc36.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/conn-olpc.c')
-rw-r--r-- | src/conn-olpc.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/conn-olpc.c b/src/conn-olpc.c index 8b3576b2d..58da3c313 100644 --- a/src/conn-olpc.c +++ b/src/conn-olpc.c @@ -290,7 +290,7 @@ get_properties_reply_cb (GObject *source, gabble_svc_olpc_buddy_info_return_from_get_properties (ctx->context, properties); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); out: pubsub_query_ctx_free (ctx); @@ -418,7 +418,7 @@ gabble_connection_connected_olpc (GabbleConnection *conn) if (preload != NULL) { transmit_properties (conn, preload, NULL); - g_hash_table_destroy (preload); + g_hash_table_unref (preload); } } @@ -454,7 +454,7 @@ olpc_buddy_info_set_properties (GabbleSvcOLPCBuddyInfo *iface, preload = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) tp_g_value_slice_free); g_object_set_qdata_full ((GObject *) conn, preload_quark, preload, - (GDestroyNotify) g_hash_table_destroy); + (GDestroyNotify) g_hash_table_unref); } tp_g_hash_table_update (preload, properties, @@ -496,7 +496,7 @@ olpc_buddy_props_pep_node_changed (WockyPepService *pep, properties = lm_message_node_extract_properties (node, "property"); gabble_svc_olpc_buddy_info_emit_properties_changed (conn, handle, properties); - g_hash_table_destroy (properties); + g_hash_table_unref (properties); out: tp_handle_unref (contact_repo, handle); } @@ -749,7 +749,7 @@ free_activities (GPtrArray *activities) for (i = 0; i < activities->len; i++) g_boxed_free (GABBLE_STRUCT_TYPE_ACTIVITY, activities->pdata[i]); - g_ptr_array_free (activities, TRUE); + g_ptr_array_unref (activities); } static void @@ -1968,7 +1968,7 @@ olpc_activity_properties_get_properties (GabbleSvcOLPCActivityProperties *iface, properties); if (not_prop) - g_hash_table_destroy (properties); + g_hash_table_unref (properties); } struct _i_hate_g_hash_table_foreach @@ -2099,7 +2099,7 @@ update_activity_properties (GabbleConnection *conn, if (g_hash_table_size (new_properties) == 0) { - g_hash_table_destroy (new_properties); + g_hash_table_unref (new_properties); return; } @@ -2897,7 +2897,7 @@ connection_presence_do_update (GabblePresenceCache *cache, gabble_svc_olpc_buddy_info_emit_activities_changed (conn, handle, empty); - g_ptr_array_free (empty, TRUE); + g_ptr_array_unref (empty); } } @@ -2997,20 +2997,20 @@ unref_activities_in_each_set (TpHandle handle, void conn_olpc_activity_properties_dispose (GabbleConnection *self) { - g_hash_table_destroy (self->olpc_current_act); + g_hash_table_unref (self->olpc_current_act); self->olpc_current_act = NULL; g_hash_table_foreach (self->olpc_pep_activities, (GHFunc) unref_activities_in_each_set, self); - g_hash_table_destroy (self->olpc_pep_activities); + g_hash_table_unref (self->olpc_pep_activities); self->olpc_pep_activities = NULL; g_hash_table_foreach (self->olpc_invited_activities, (GHFunc) unref_activities_in_each_set, self); - g_hash_table_destroy (self->olpc_invited_activities); + g_hash_table_unref (self->olpc_invited_activities); self->olpc_invited_activities = NULL; - g_hash_table_destroy (self->olpc_activities_info); + g_hash_table_unref (self->olpc_activities_info); self->olpc_activities_info = NULL; } |