From d5be073d8f5bd6ba78227aa7a6080503ffd375f4 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 11 Apr 2012 11:59:32 +0100 Subject: [PATCH 1/3] channel-contacts: merge contacts_queue_item_new into contacts_queue_item --- telepathy-glib/channel-contacts.c | 40 ++++++++++--------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/telepathy-glib/channel-contacts.c b/telepathy-glib/channel-contacts.c index dc381a3..efaa9a0 100644 --- a/telepathy-glib/channel-contacts.c +++ b/telepathy-glib/channel-contacts.c @@ -242,22 +242,6 @@ struct _ContactsQueueItem GArray *handles; }; -static ContactsQueueItem * -contacts_queue_item_new (GPtrArray *contacts, - GPtrArray *ids, - GArray *handles) -{ - ContactsQueueItem *item; - - item = g_slice_new (ContactsQueueItem); - item->contacts = contacts != NULL ? g_ptr_array_ref (contacts) : NULL; - item->ids = ids != NULL ? g_ptr_array_ref (ids) : NULL; - item->handles = handles != NULL ? g_array_ref (handles) : NULL; - item->result = NULL; - - return item; -} - static void contacts_queue_item_free (ContactsQueueItem *item) { @@ -445,10 +429,17 @@ process_contacts_queue (TpChannel *self) static void contacts_queue_item (TpChannel *self, - ContactsQueueItem *item, + GPtrArray *contacts, + GPtrArray *ids, + GArray *handles, GAsyncReadyCallback callback, gpointer user_data) { + ContactsQueueItem *item = g_slice_new (ContactsQueueItem); + + item->contacts = contacts != NULL ? g_ptr_array_ref (contacts) : NULL; + item->ids = ids != NULL ? g_ptr_array_ref (ids) : NULL; + item->handles = handles != NULL ? g_array_ref (handles) : NULL; item->result = g_simple_async_result_new ((GObject *) self, callback, user_data, contacts_queue_item); @@ -464,10 +455,7 @@ _tp_channel_contacts_queue_prepare_async (TpChannel *self, GAsyncReadyCallback callback, gpointer user_data) { - ContactsQueueItem *item; - - item = contacts_queue_item_new (contacts, NULL, NULL); - contacts_queue_item (self, item, callback, user_data); + contacts_queue_item (self, contacts, NULL, NULL, callback, user_data); } void @@ -476,10 +464,7 @@ _tp_channel_contacts_queue_prepare_by_id_async (TpChannel *self, GAsyncReadyCallback callback, gpointer user_data) { - ContactsQueueItem *item; - - item = contacts_queue_item_new (NULL, ids, NULL); - contacts_queue_item (self, item, callback, user_data); + contacts_queue_item (self, NULL, ids, NULL, callback, user_data); } void @@ -488,10 +473,7 @@ _tp_channel_contacts_queue_prepare_by_handle_async (TpChannel *self, GAsyncReadyCallback callback, gpointer user_data) { - ContactsQueueItem *item; - - item = contacts_queue_item_new (NULL, NULL, handles); - contacts_queue_item (self, item, callback, user_data); + contacts_queue_item (self, NULL, NULL, handles, callback, user_data); } gboolean -- 1.7.9.5