summaryrefslogtreecommitdiffstats
path: root/src/debug.h
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-01-12 19:09:36 +0100
committerGravatar Martin Szulecki2010-01-12 19:09:36 +0100
commit342f4e929888c0aaa088e39fb98a74957bf45fa7 (patch)
tree905bafb1b353b8ac21e3fb1f9c773d218a5c878e /src/debug.h
parentbf3dc421b2b5ccfe2fcd3cd4ec1ef90f39599600 (diff)
downloadlibimobiledevice-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.h20
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 @@
1/* 1/*
2 * debug.h 2 * debug.h
3 * contains utilitary methos for logging and debugging 3 * contains utilitary functions for debugging
4 * 4 *
5 * Copyright (c) 2008 Jonathan Beck All Rights Reserved. 5 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
6 * 6 *
@@ -24,8 +24,20 @@
24 24
25#include <glib.h> 25#include <glib.h>
26 26
27G_GNUC_INTERNAL inline void log_debug_msg(const char *format, ...); 27#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(STRIP_DEBUG_CODE)
28G_GNUC_INTERNAL inline void log_debug_buffer(const char *data, const int length); 28#define debug_info(...) debug_info_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
29G_GNUC_INTERNAL inline void dump_debug_buffer(const char *file, const char *data, const int length); 29#elif defined(__GNUC__) && __GNUC__ >= 3 && !defined(STRIP_DEBUG_CODE)
30#define debug_info(...) debug_info_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
31#else
32#define debug_info(...)
33#endif
34
35G_GNUC_INTERNAL inline void debug_info_real(const char *func,
36 const char *file,
37 int line,
38 const char *format, ...);
39
40G_GNUC_INTERNAL inline void debug_buffer(const char *data, const int length);
41G_GNUC_INTERNAL inline void debug_buffer_to_file(const char *file, const char *data, const int length);
30 42
31#endif 43#endif