From 3e6af058ebce582c43af16450c9719fbe2cb65cb Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 12 Jan 2010 19:50:07 +0100 Subject: Add debug function to print a plist --- src/debug.c | 13 +++++++++++++ src/debug.h | 2 ++ 2 files changed, 15 insertions(+) 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 #include #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 -- cgit v1.1-32-gdbae