summaryrefslogtreecommitdiff
path: root/include/glibtop
diff options
context:
space:
mode:
authorBenoit Dejean <bdejean@gmail.com>2015-06-21 22:35:52 +0200
committerBenoit Dejean <bdejean@gmail.com>2015-07-15 18:38:27 +0200
commit887092a05db4708b4f46e6d788ccfe2e25c70ef6 (patch)
tree1c6c522fbf5fd6b2949c72e4f613db663fb7f669 /include/glibtop
parentb2a2f6b5c2937bdfb5329f6aefa3cb0ff67fafa8 (diff)
downloadlibgtop-887092a05db4708b4f46e6d788ccfe2e25c70ef6.tar.gz
Define glibtop_debug(_r) as macros, eventually calling real C function.
Keep these as macros so that if debug is not enable, although the debug message is parsed, it's not run. It's better this way because the debug message is always parsed and checked instead of being deleted by the preprocessor.
Diffstat (limited to 'include/glibtop')
-rw-r--r--include/glibtop/error.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/glibtop/error.h b/include/glibtop/error.h
index 76e1abe8..fdce2fd3 100644
--- a/include/glibtop/error.h
+++ b/include/glibtop/error.h
@@ -47,14 +47,16 @@ void glibtop_error_io (const char *format, ...) G_GNUC_PRINTF(1, 2) G_GNUC_NORET
void glibtop_warn_io (const char *format, ...) G_GNUC_PRINTF(1, 2);
/* FIXME: C99 */
-#define glibtop_debug(fmt, ...) \
+#define glibtop_debug_r(server, fmt, ...) \
G_STMT_START { \
if (LIBGTOP_ENABLE_DEBUG) \
- glibtop_debug_r(glibtop_global_server, fmt, ##__VA_ARGS__); \
+ glibtop_debug_r_real(server, fmt, ##__VA_ARGS__); \
} G_STMT_END
+#define glibtop_debug(...) glibtop_debug_r(glibtop_global_server, __VA_ARGS__)
+
void glibtop_debug_vr (glibtop *server, const char *format, va_list args);
-void glibtop_debug_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3);
+void glibtop_debug_r_real (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3);
G_END_DECLS