diff options
author | Martin Szulecki | 2010-01-12 19:50:07 +0100 |
---|---|---|
committer | Martin Szulecki | 2010-01-12 19:50:07 +0100 |
commit | 3e6af058ebce582c43af16450c9719fbe2cb65cb (patch) | |
tree | c47f4d12ac80c714a103e5a7129fcea315e3af09 | |
parent | 04e1f74afe0efe4d09affed9b9fee08847b78ab9 (diff) | |
download | libimobiledevice-3e6af058ebce582c43af16450c9719fbe2cb65cb.tar.gz libimobiledevice-3e6af058ebce582c43af16450c9719fbe2cb65cb.tar.bz2 |
Add debug function to print a plist
-rw-r--r-- | src/debug.c | 13 | ||||
-rw-r--r-- | src/debug.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c index cf93e01..8912b3a 100644 --- a/src/debug.c +++ b/src/debug.c @@ -134,3 +134,16 @@ inline void debug_buffer_to_file(const char *file, const char *data, const int l } #endif } + +inline void debug_plist(plist_t plist) +{ + if (!plist) + return; + + char *buffer = NULL; + uint32_t length = 0; + plist_to_xml(plist, &buffer, &length); + debug_info("plist size: %i\nbuffer :\n%s", length, buffer); + free(buffer); +} + diff --git a/src/debug.h b/src/debug.h index f99089d..0a29be3 100644 --- a/src/debug.h +++ b/src/debug.h @@ -22,6 +22,7 @@ #ifndef DEBUG_H #define DEBUG_H +#include <plist/plist.h> #include <glib.h> #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(STRIP_DEBUG_CODE) @@ -39,5 +40,6 @@ G_GNUC_INTERNAL inline void debug_info_real(const char *func, 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); +G_GNUC_INTERNAL inline void debug_plist(plist_t plist); #endif |