[lasem] debug: implement lsm_debug, lsm_warning and lsm_log as functions.



commit 18f288296f327d9b05600984ae6fede7eabc985a
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Mon May 9 11:13:24 2011 +0200

    debug: implement lsm_debug, lsm_warning and lsm_log as functions.

 src/lsmdebug.c |   36 +++++++++++++++++++++++++++++++-----
 src/lsmdebug.h |    9 +++------
 2 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/src/lsmdebug.c b/src/lsmdebug.c
index a885cce..f318347 100644
--- a/src/lsmdebug.c
+++ b/src/lsmdebug.c
@@ -126,17 +126,43 @@ lsm_debug_check	(LsmDebugCategory *category, LsmDebugLevel level)
 	return (int) level <= (int) category->level;
 }
 
-void
-lsm_debug_with_level (LsmDebugCategory *category, LsmDebugLevel level, const char *format, ...)
+static void
+lsm_debug_with_level (LsmDebugCategory *category, LsmDebugLevel level, const char *format, va_list args)
 {
-	va_list args;
-
 	if (!lsm_debug_check (category, level))
 		return;
 
-	va_start (args, format);
 	g_vprintf (format, args);
 	g_printf ("\n");
+}
+
+void
+lsm_warning (LsmDebugCategory *category, const char *format, ...)
+{
+	va_list args;
+
+	va_start (args, format);
+	lsm_debug_with_level (category, LSM_DEBUG_LEVEL_WARNING, format, args);
+	va_end (args);
+}
+
+void
+lsm_debug (LsmDebugCategory *category, const char *format, ...)
+{
+	va_list args;
+
+	va_start (args, format);
+	lsm_debug_with_level (category, LSM_DEBUG_LEVEL_DEBUG, format, args);
+	va_end (args);
+}
+
+void
+lsm_log (LsmDebugCategory *category, const char *format, ...)
+{
+	va_list args;
+
+	va_start (args, format);
+	lsm_debug_with_level (category, LSM_DEBUG_LEVEL_LOG, format, args);
 	va_end (args);
 }
 
diff --git a/src/lsmdebug.h b/src/lsmdebug.h
index 73f2d08..838aa02 100644
--- a/src/lsmdebug.h
+++ b/src/lsmdebug.h
@@ -62,12 +62,9 @@ extern LsmDebugCategory lsm_debug_category_render;
 #define lsm_log_render(...)		lsm_log (&lsm_debug_category_render, __VA_ARGS__)
 #define lsm_warning_render(...)		lsm_warning (&lsm_debug_category_render, __VA_ARGS__)
 
-#define lsm_warning(c,...)		lsm_debug_with_level ((c), LSM_DEBUG_LEVEL_WARNING, __VA_ARGS__)
-#define lsm_debug(c,...)		lsm_debug_with_level (c, LSM_DEBUG_LEVEL_DEBUG, __VA_ARGS__)
-#define lsm_log(c,...)			lsm_debug_with_level ((c), LSM_DEBUG_LEVEL_LOG, __VA_ARGS__)
-
-void		lsm_debug_with_level		(LsmDebugCategory *category, LsmDebugLevel level,
-						 const char *format, ...);
+void 		lsm_warning 			(LsmDebugCategory *category, const char *format, ...);
+void 		lsm_debug 			(LsmDebugCategory *category, const char *format, ...);
+void 		lsm_log 			(LsmDebugCategory *category, const char *format, ...);
 
 gboolean	lsm_debug_check			(LsmDebugCategory *category, LsmDebugLevel level);
 



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