diff options
author | Martin Szulecki | 2010-01-12 19:09:36 +0100 |
---|---|---|
committer | Martin Szulecki | 2010-01-12 19:09:36 +0100 |
commit | 342f4e929888c0aaa088e39fb98a74957bf45fa7 (patch) | |
tree | 905bafb1b353b8ac21e3fb1f9c773d218a5c878e /src/debug.h | |
parent | bf3dc421b2b5ccfe2fcd3cd4ec1ef90f39599600 (diff) | |
download | libimobiledevice-342f4e929888c0aaa088e39fb98a74957bf45fa7.tar.gz libimobiledevice-342f4e929888c0aaa088e39fb98a74957bf45fa7.tar.bz2 |
Refactor and unify internal debug system for ease of use and verbosity
This introduces a new debug_info macro which automatically prints
the calling function, file and line number information instead of
having that information passed to every old log_debug_msg call.
Diffstat (limited to 'src/debug.h')
-rw-r--r-- | src/debug.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/debug.h b/src/debug.h index 398508e..f99089d 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,6 +1,6 @@ /* * debug.h - * contains utilitary methos for logging and debugging + * contains utilitary functions for debugging * * Copyright (c) 2008 Jonathan Beck All Rights Reserved. * @@ -24,8 +24,20 @@ #include <glib.h> -G_GNUC_INTERNAL inline void log_debug_msg(const char *format, ...); -G_GNUC_INTERNAL inline void log_debug_buffer(const char *data, const int length); -G_GNUC_INTERNAL inline void dump_debug_buffer(const char *file, const char *data, const int length); +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(STRIP_DEBUG_CODE) +#define debug_info(...) debug_info_real (__func__, __FILE__, __LINE__, __VA_ARGS__) +#elif defined(__GNUC__) && __GNUC__ >= 3 && !defined(STRIP_DEBUG_CODE) +#define debug_info(...) debug_info_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) +#else +#define debug_info(...) +#endif + +G_GNUC_INTERNAL inline void debug_info_real(const char *func, + const char *file, + int line, + const char *format, ...); + +G_GNUC_INTERNAL inline void debug_buffer(const char *data, const int length); +G_GNUC_INTERNAL inline void debug_buffer_to_file(const char *file, const char *data, const int length); #endif |