summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2013-10-15 15:38:30 +0300
committerJakub Hrozek <jhrozek@redhat.com>2014-05-02 10:58:10 +0200
commitb9afd88065ecdb9c2cafb2ee767bd61585b31b8f (patch)
treeb67d45a2c78597b702cad30ce2cc47f20a074879 /src
parent38e51a251fe4f76fd26f6f50948d57487bc5988d (diff)
downloadsssd-b9afd88065ecdb9c2cafb2ee767bd61585b31b8f.tar.gz
sssd-b9afd88065ecdb9c2cafb2ee767bd61585b31b8f.tar.xz
sssd-b9afd88065ecdb9c2cafb2ee767bd61585b31b8f.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> (cherry picked from commit cc026fd9ba386f2197e3217940d597dcad1a26fe)
Diffstat (limited to 'src')
-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 4b3c965f6..1390a9e14 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -106,9 +106,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
@@ -121,12 +119,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)