[telepathy-gabble/telepathy-gabble-0.8] call DEBUG() in location_set_location() to avoid #define/#undef pairs

Dafydd Harries dafydd.harries at collabora.co.uk
Tue Sep 22 08:25:37 PDT 2009


---
 src/conn-location.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/conn-location.c b/src/conn-location.c
index 0d25570..fbfbd25 100644
--- a/src/conn-location.c
+++ b/src/conn-location.c
@@ -193,11 +193,9 @@ add_to_geoloc_node (const gchar *tp_name,
     {
       if (G_VALUE_TYPE (value) != G_TYPE_STRING)
         {
-#define ERROR_MSG "expecting string for language value, but got %s",\
-              G_VALUE_TYPE_NAME (value)
-          DEBUG (ERROR_MSG);
-          g_set_error (err, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, ERROR_MSG);
-#undef ERROR_MSG
+          g_set_error (err, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+              "expecting string for language value, but got %s",
+                  G_VALUE_TYPE_NAME (value));
           return FALSE;
         }
 
@@ -218,13 +216,10 @@ add_to_geoloc_node (const gchar *tp_name,
 
   if (G_VALUE_TYPE (value) != mapping->type)
     {
-#define ERROR_MSG "'%s' is supposed to be of type %s but is %s",\
-          (const char *) tp_name, g_type_name (mapping->type),\
-          G_VALUE_TYPE_NAME (value)
-
-      DEBUG (ERROR_MSG);
-      g_set_error (err, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, ERROR_MSG);
-#undef ERROR_MSG
+      g_set_error (err, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+          "'%s' is supposed to be of type %s but is %s",
+          (const char *) tp_name, g_type_name (mapping->type),
+          G_VALUE_TYPE_NAME (value));
       return FALSE;
     }
 
@@ -291,6 +286,7 @@ location_set_location (TpSvcConnectionInterfaceLocation *iface,
       if (!add_to_geoloc_node ((const gchar *) key, (GValue *) value, geoloc,
             &err))
         {
+          DEBUG ("%s", err->message);
           dbus_g_method_return_error (context, err);
           g_error_free (err);
           goto out;
-- 
1.5.6.5



More information about the telepathy-commits mailing list