[mutter/wip/display-no-wayland: 5/33] Strip whitespace in warnings and errors



commit b04ac57f024adb73c32d08ecd09762157fe18e9b
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon May 20 21:56:21 2013 +0200

    Strip whitespace in warnings and errors
    
    The old log system did not add a newline at the end, but the new
    one does, so don't add another one.

 src/core/util.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/core/util.c b/src/core/util.c
index 6c004e1..aee8be7 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -437,38 +437,53 @@ meta_debug_init (void)
 void
 meta_bug (const char *format, ...)
 {
+  char *stripped;
   va_list args;
 
   g_return_if_fail (format != NULL);
 
+  stripped = g_strstrip (g_strdup (format));
+
   va_start (args, format);
-  g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
+  g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, stripped, args);
   va_end (args);
+
+  g_free (stripped);
 }
 
 void
 meta_warning (const char *format, ...)
 {
+  char *stripped;
   va_list args;
 
   g_return_if_fail (format != NULL);
 
+  stripped = g_strstrip (g_strdup (format));
+
   va_start (args, format);
-  g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args);
+  g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, stripped, args);
   va_end (args);
+
+  g_free (stripped);
 }
 
 void
 meta_fatal (const char *format, ...)
 {
+  char *stripped;
   va_list args;
 
   g_return_if_fail (format != NULL);
 
+  stripped = g_strstrip (g_strdup (format));
+
   va_start (args, format);
-  g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, args);
+  g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, stripped, args);
   va_end (args);
 
+  g_free (stripped);
+
   meta_exit (META_EXIT_ERROR);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]