[telepathy-gabble/master] Fix misc. problems and remove some code duplication.

Jonny Lamb jonny.lamb at collabora.co.uk
Wed Jun 3 06:10:55 PDT 2009


Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
 src/debug.c    |    8 +-------
 src/debugger.c |    8 ++++----
 src/debugger.h |    2 +-
 src/gabble.c   |    3 +--
 4 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/debug.c b/src/debug.c
index 45f7509..319a44a 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -89,24 +89,18 @@ log_to_debugger (GabbleDebugFlags flag,
 		 va_list args)
 {
   GabbleDebugger *dbg = gabble_debugger_get_singleton ();
-  gdouble seconds;
   gchar *domain, *message = NULL;
-  va_list args;
   GTimeVal now;
 
   g_get_current_time (&now);
-  seconds = now.tv_sec + now.tv_usec / 1e6;
 
   domain = g_strdup_printf ("%s/%s", G_LOG_DOMAIN, debug_flag_to_key (flag));
-
-  va_start (args, format);
   message = g_strdup_vprintf (format, args);
 
-  gabble_debugger_add_message (dbg, seconds, domain, G_LOG_LEVEL_DEBUG, message);
+  gabble_debugger_add_message (dbg, &now, domain, G_LOG_LEVEL_DEBUG, message);
 
   g_free (message);
   g_free (domain);
-  va_end (args);
 }
 
 void gabble_debug (GabbleDebugFlags flag,
diff --git a/src/debugger.c b/src/debugger.c
index 01cf939..a4679da 100644
--- a/src/debugger.c
+++ b/src/debugger.c
@@ -72,7 +72,7 @@ log_level_flags_to_debug_level (GLogLevelFlags level)
 }
 
 static GabbleDebugMessage *
-debug_message_new (gdouble timestamp,
+debug_message_new (GTimeVal *timestamp,
     const gchar *domain,
     GLogLevelFlags level,
     const gchar *string)
@@ -80,7 +80,7 @@ debug_message_new (gdouble timestamp,
   GabbleDebugMessage *msg;
 
   msg = g_slice_new0 (GabbleDebugMessage);
-  msg->timestamp = timestamp;
+  msg->timestamp = timestamp->tv_sec + timestamp->tv_usec / 1e6;
   msg->domain = g_strdup (domain);
   msg->level = log_level_flags_to_debug_level (level);
   msg->string = g_strdup (string);
@@ -247,7 +247,7 @@ gabble_debugger_get_singleton (void)
 
 void
 gabble_debugger_add_message (GabbleDebugger *self,
-    gdouble timestamp,
+    GTimeVal *timestamp,
     const gchar *domain,
     GLogLevelFlags level,
     const gchar *string)
@@ -268,7 +268,7 @@ gabble_debugger_add_message (GabbleDebugger *self,
   if (self->enabled)
     {
       g_signal_emit_by_name (
-          G_OBJECT (self), "new-debug-message", timestamp, string);
+          G_OBJECT (self), "new-debug-message", new_msg->timestamp, string);
     }
 }
 
diff --git a/src/debugger.h b/src/debugger.h
index 95ce0d7..a6d41cf 100644
--- a/src/debugger.h
+++ b/src/debugger.h
@@ -78,7 +78,7 @@ gabble_debugger_get_singleton (void);
 
 void
 gabble_debugger_add_message (GabbleDebugger *self,
-    gdouble timestamp,
+    GTimeVal *timestamp,
     const gchar *domain,
     GLogLevelFlags level,
     const gchar *string);
diff --git a/src/gabble.c b/src/gabble.c
index 6d03f95..ac35153 100644
--- a/src/gabble.c
+++ b/src/gabble.c
@@ -45,9 +45,8 @@ log_to_debugger (GTimeVal *timestamp,
 		 const gchar *string)
 {
   GabbleDebugger *dbg = gabble_debugger_get_singleton ();
-  gdouble seconds = timestamp->tv_sec + timestamp->tv_usec / 1e6;
 
-  gabble_debugger_add_message (dbg, seconds, log_domain, log_level, string);
+  gabble_debugger_add_message (dbg, timestamp, log_domain, log_level, string);
 }
 
 static void
-- 
1.5.6.5




More information about the telepathy-commits mailing list