[next] telepathy-glib: Replace dbus_g_method_get_sender with g_dbus_method_invocation_get_sender

Simon McVittie smcv at kemper.freedesktop.org
Thu Mar 27 08:42:04 PDT 2014


Module: telepathy-glib
Branch: next
Commit: ddc673b744983f80c44dee42f8dd7025d7b7fa69
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=ddc673b744983f80c44dee42f8dd7025d7b7fa69

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Mar 11 17:25:33 2014 +0000

Replace dbus_g_method_get_sender with g_dbus_method_invocation_get_sender

It doesn't copy the string, unlike dbus_g_method_get_sender.

---

 telepathy-glib/base-channel.c    |    3 +--
 telepathy-glib/base-connection.c |   10 ++++------
 telepathy-glib/message-mixin.c   |    3 +--
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/telepathy-glib/base-channel.c b/telepathy-glib/base-channel.c
index 4bf6866..e14545e 100644
--- a/telepathy-glib/base-channel.c
+++ b/telepathy-glib/base-channel.c
@@ -1072,10 +1072,9 @@ tp_base_channel_close_dbus (
 
   if (DEBUGGING)
     {
-      gchar *caller = dbus_g_method_get_sender (context);
+      const gchar *caller = g_dbus_method_invocation_get_sender (context);
 
       DEBUG ("called by %s", caller);
-      g_free (caller);
     }
 
   tp_base_channel_close (chan);
diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index c0d3ad8..f932db0 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -2203,7 +2203,7 @@ tp_base_connection_dbus_add_client_interest (TpSvcConnection *svc,
     GDBusMethodInvocation *context)
 {
   TpBaseConnection *self = (TpBaseConnection *) svc;
-  gchar *unique_name = NULL;
+  const gchar *unique_name = NULL;
 
   g_return_if_fail (TP_IS_BASE_CONNECTION (self));
   g_return_if_fail (self->priv->bus_proxy != NULL);
@@ -2211,14 +2211,13 @@ tp_base_connection_dbus_add_client_interest (TpSvcConnection *svc,
   if (interests == NULL || interests[0] == NULL)
     goto finally;
 
-  unique_name = dbus_g_method_get_sender (context);
+  unique_name = g_dbus_method_invocation_get_sender (context);
 
   tp_base_connection_add_client_interest_impl (self, unique_name,
       (const gchar * const *) interests, FALSE);
 
 finally:
   tp_svc_connection_return_from_add_client_interest (context);
-  g_free (unique_name);
 }
 
 static void
@@ -2226,7 +2225,7 @@ tp_base_connection_dbus_remove_client_interest (TpSvcConnection *svc,
     const gchar **interests,
     GDBusMethodInvocation *context)
 {
-  gchar *unique_name = NULL;
+  const gchar *unique_name = NULL;
   const gchar **interest;
   TpBaseConnection *self = (TpBaseConnection *) svc;
   gpointer name_in_hash, count_p;
@@ -2238,7 +2237,7 @@ tp_base_connection_dbus_remove_client_interest (TpSvcConnection *svc,
   if (interests == NULL || interests[0] == NULL)
     goto finally;
 
-  unique_name = dbus_g_method_get_sender (context);
+  unique_name = g_dbus_method_invocation_get_sender (context);
 
   /* this method isn't really meant to fail, so we might as well return now */
 
@@ -2321,7 +2320,6 @@ tp_base_connection_dbus_remove_client_interest (TpSvcConnection *svc,
 
 finally:
   tp_svc_connection_return_from_remove_client_interest (context);
-  g_free (unique_name);
 }
 
 /* The handling of calls to Connection.Interface.Requests.CreateChannel is
diff --git a/telepathy-glib/message-mixin.c b/telepathy-glib/message-mixin.c
index 9d9f5c5..92ba0d8 100644
--- a/telepathy-glib/message-mixin.c
+++ b/telepathy-glib/message-mixin.c
@@ -550,11 +550,10 @@ tp_message_mixin_acknowledge_pending_messages_async (
 
       if (tp_intset_is_member (seen, id))
         {
-          gchar *client = dbus_g_method_get_sender (context);
+          const gchar *client = g_dbus_method_invocation_get_sender (context);
 
           DEBUG ("%s passed message id %u more than once in one call to "
               "AcknowledgePendingMessages. Foolish pup.", client, id);
-          g_free (client);
           continue;
         }
 



More information about the telepathy-commits mailing list