[telepathy-mission-control/master] _mcd_client_proxy_handle_channels: allow handler_info to be NULL, for the common case that it's empty

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Nov 2 07:18:14 PST 2009


There are no defined keys yet, so it's always empty for now.
---
 src/mcd-client.c             |   10 ++++++++++
 src/mcd-dispatch-operation.c |    7 +------
 src/mcd-dispatcher.c         |    7 +------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/mcd-client.c b/src/mcd-client.c
index 4676a8e..c8875b5 100644
--- a/src/mcd-client.c
+++ b/src/mcd-client.c
@@ -1576,6 +1576,15 @@ _mcd_client_proxy_handle_channels (McdClientProxy *self,
     channel_details = _mcd_channel_details_build_from_list (channels);
     requests_satisfied = g_ptr_array_new ();
 
+    if (handler_info == NULL)
+    {
+        handler_info = g_hash_table_new (g_str_hash, g_str_equal);
+    }
+    else
+    {
+        g_hash_table_ref (handler_info);
+    }
+
     for (iter = channels; iter != NULL; iter = iter->next)
     {
         gint64 req_time = 0;
@@ -1605,4 +1614,5 @@ _mcd_client_proxy_handle_channels (McdClientProxy *self,
 
     _mcd_channel_details_free (channel_details);
     g_ptr_array_free (requests_satisfied, TRUE);
+    g_hash_table_unref (handler_info);
 }
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index cf44cfa..4719ea7 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1664,21 +1664,16 @@ mcd_dispatch_operation_handle_channels (McdDispatchOperation *self,
                                         McdClientProxy *handler)
 {
     const gchar *account_path;
-    GHashTable *handler_info;
 
     account_path = _mcd_dispatch_operation_get_account_path (self);
 
-    handler_info = g_hash_table_new (g_str_hash, g_str_equal);
-
     DEBUG ("calling HandleChannels on %s for op %p",
            tp_proxy_get_bus_name (handler), self);
     _mcd_client_proxy_handle_channels (handler,
         -1, account_path,
         self->priv->channels, self->priv->handle_with_time,
-        handler_info, _mcd_dispatch_operation_handle_channels_cb,
+        NULL, _mcd_dispatch_operation_handle_channels_cb,
         g_object_ref (self), g_object_unref, NULL);
-
-    g_hash_table_unref (handler_info);
 }
 
 void
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 1ad10a4..cc84f94 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1759,7 +1759,6 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
     GList *request_as_list;
     const gchar *handler_unique;
     GStrv possible_handlers;
-    GHashTable *handler_info;
     McdAccount *account;
     const gchar *account_path;
     McdClientProxy *handler;
@@ -1815,16 +1814,12 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
     if (G_UNLIKELY (account_path == NULL))    /* can't happen? */
         account_path = "/";
 
-    handler_info = g_hash_table_new (g_str_hash, g_str_equal);
-
     _mcd_client_proxy_handle_channels (handler,
         -1, account_path, request_as_list,
         0, /* the request's user action time will be used automatically */
-        handler_info,
+        NULL, /* no extra handler_info */
         reinvoke_handle_channels_cb, NULL, NULL, (GObject *) request);
 
-    g_hash_table_unref (handler_info);
-
 finally:
     g_list_free (request_as_list);
     g_strfreev (possible_handlers);
-- 
1.5.6.5




More information about the telepathy-commits mailing list