[next] telepathy-glib: TpBaseConnection: use g_dbus_method_invocation_return_error_literal

Simon McVittie smcv at kemper.freedesktop.org
Wed May 7 02:18:23 PDT 2014


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Apr 11 14:54:07 2014 +0100

TpBaseConnection: use g_dbus_method_invocation_return_error_literal

This avoids putting a temporary GError on the stack, which was always
slightly questionable use of the GError API.

Reviewed-by: Xavier Claessens <xavier.claessens at collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77189

---

 telepathy-glib/base-connection.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index 45631fe..f7a13e9 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -2286,8 +2286,8 @@ static void conn_requests_offer_request (TpBaseConnection *self,
 
 #define RETURN_INVALID_ARGUMENT(message) \
   G_STMT_START { \
-    GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, message }; \
-    g_dbus_method_invocation_return_gerror (context, &e); \
+    g_dbus_method_invocation_return_error_literal (context, TP_ERROR, \
+        TP_ERROR_INVALID_ARGUMENT, message); \
     return; \
   } G_STMT_END
 
@@ -2425,10 +2425,9 @@ conn_requests_requestotron_validate_handle (TpBaseConnection *self,
 
       if (handles == NULL)
         {
-          GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
-              "entity type not supported by this connection manager" };
-
-          g_dbus_method_invocation_return_gerror (context, &e);
+          g_dbus_method_invocation_return_error_literal (context,
+              TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+              "entity type not supported by this connection manager");
           return;
         }
 



More information about the telepathy-commits mailing list