[next] telepathy-glib: debug-message: strip the message from trailing whitespaces

Simon McVittie smcv at kemper.freedesktop.org
Wed Apr 25 07:26:08 PDT 2012


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

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Mon Apr 16 11:22:47 2012 +0200

debug-message: strip the message from trailing whitespaces

empathy-debug-window was doing that; it doesn't hurt and will save Empathy
from copying the string to strip it itself.

---

 telepathy-glib/debug-message.c |    3 ++-
 tests/dbus/debug-client.c      |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/telepathy-glib/debug-message.c b/telepathy-glib/debug-message.c
index 463df39..8f7943a 100644
--- a/telepathy-glib/debug-message.c
+++ b/telepathy-glib/debug-message.c
@@ -164,7 +164,7 @@ tp_debug_message_class_init (
   /**
    * TpDebugMessage:message:
    *
-   * Text of the debug message
+   * Text of the debug message, stripped from its trailing whitespaces.
    *
    * Since: UNRELEASED
    */
@@ -226,6 +226,7 @@ _tp_debug_message_new (gdouble timestamp,
   self->priv->domain = g_strdup (domain);
   self->priv->level = debug_level_to_log_level_flags (level);
   self->priv->message = g_strdup (message);
+  g_strchomp (self->priv->message);
 
   return self;
 }
diff --git a/tests/dbus/debug-client.c b/tests/dbus/debug-client.c
index db02bf8..6c73bfd 100644
--- a/tests/dbus/debug-client.c
+++ b/tests/dbus/debug-client.c
@@ -207,7 +207,7 @@ test_get_messages (Test *test,
   g_date_time_to_timeval (time1, &time_val);
 
   tp_debug_sender_add_message (test->sender, &time_val, "domain1",
-      G_LOG_LEVEL_MESSAGE, "message1");
+      G_LOG_LEVEL_MESSAGE, "message1\n");
 
   time2 = g_date_time_new_now_local ();
   g_date_time_to_timeval (time2, &time_val);



More information about the telepathy-commits mailing list