summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-01-12 19:50:07 +0100
committerGravatar Martin Szulecki2010-01-12 19:50:07 +0100
commit3e6af058ebce582c43af16450c9719fbe2cb65cb (patch)
treec47f4d12ac80c714a103e5a7129fcea315e3af09 /src
parent04e1f74afe0efe4d09affed9b9fee08847b78ab9 (diff)
downloadlibimobiledevice-3e6af058ebce582c43af16450c9719fbe2cb65cb.tar.gz
libimobiledevice-3e6af058ebce582c43af16450c9719fbe2cb65cb.tar.bz2
Add debug function to print a plist
Diffstat (limited to 'src')
-rw-r--r--src/debug.c13
-rw-r--r--src/debug.h2
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
134 } 134 }
135#endif 135#endif
136} 136}
137
138inline void debug_plist(plist_t plist)
139{
140 if (!plist)
141 return;
142
143 char *buffer = NULL;
144 uint32_t length = 0;
145 plist_to_xml(plist, &buffer, &length);
146 debug_info("plist size: %i\nbuffer :\n%s", length, buffer);
147 free(buffer);
148}
149
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 @@
22#ifndef DEBUG_H 22#ifndef DEBUG_H
23#define DEBUG_H 23#define DEBUG_H
24 24
25#include <plist/plist.h>
25#include <glib.h> 26#include <glib.h>
26 27
27#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(STRIP_DEBUG_CODE) 28#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,
39 40
40G_GNUC_INTERNAL inline void debug_buffer(const char *data, const int length); 41G_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); 42G_GNUC_INTERNAL inline void debug_buffer_to_file(const char *file, const char *data, const int length);
43G_GNUC_INTERNAL inline void debug_plist(plist_t plist);
42 44
43#endif 45#endif