summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2013-10-15 15:38:30 +0300
committerJakub Hrozek <jhrozek@redhat.com>2014-02-12 22:30:53 +0100
commitcc026fd9ba386f2197e3217940d597dcad1a26fe (patch)
tree9d863a3da3f5288c87484a26c873bb2b5dab17df /src/util
parent1eedbd1bd2037437f5b9aed1f4061af396ef6733 (diff)
downloadsssd-cc026fd9ba386f2197e3217940d597dcad1a26fe.tar.gz
sssd-cc026fd9ba386f2197e3217940d597dcad1a26fe.tar.xz
sssd-cc026fd9ba386f2197e3217940d597dcad1a26fe.zip
Make DEBUG macro definition variadic
Update DEBUG macro definition to accept format string and its arguments as direct variadic macro arguments, instead of expecting them as an expression in parens. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/util.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/util/util.h b/src/util/util.h
index 7650e3e9a..9cc53f880 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -109,9 +109,7 @@ errno_t set_debug_file_from_fd(const int fd);
{"debug-microseconds", 0, POPT_ARG_INT, &debug_microseconds, 0, \
_("Show timestamps with microseconds"), NULL},
-#define DEBUG_UNWRAP(...) __VA_ARGS__
-
-/** \def DEBUG(level, body)
+/** \def DEBUG(level, format, ...)
\brief macro to generate debug messages
\param level the debug level, please use one of the SSSDBG_* macros
@@ -124,12 +122,14 @@ errno_t set_debug_file_from_fd(const int fd);
looking for additional clues
- 7-10 is for informational stuff
- \param body the debug message you want to send, should end with \n
+ \param format the debug message format string, should result in a
+ newline-terminated message
+ \param ... the debug message format arguments
*/
-#define DEBUG(level, body) do { \
+#define DEBUG(level, format, ...) do { \
int __debug_macro_newlevel = debug_get_level(level); \
if (DEBUG_IS_SET(__debug_macro_newlevel)) \
- debug_fn(__FUNCTION__, __debug_macro_newlevel, DEBUG_UNWRAP body); \
+ debug_fn(__FUNCTION__, __debug_macro_newlevel, format, ##__VA_ARGS__); \
} while (0)
/** \def DEBUG_IS_SET(level)