From 8dc5f5ad7f04a2c2d1d31852f24f9e5bac4a9a53 Mon Sep 17 00:00:00 2001 From: BALATON Zoltan Date: Wed, 22 Oct 2014 22:59:47 +0200 Subject: Supress printing very long plists in debug output --- common/debug.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/debug.c b/common/debug.c index e497501..8ad0f08 100644 --- a/common/debug.c +++ b/common/debug.c @@ -39,6 +39,8 @@ #include "asprintf.h" #endif +#define MAX_PRINT_LEN 16*1024 + int debug_level = 0; /** @@ -163,7 +165,11 @@ void debug_plist_real(const char *func, const char *file, int line, plist_t plis if (buffer[length-1] == '\n') buffer[length-1] = '\0'; - debug_info_real(func, file, line, "printing %i bytes plist:\n%s", length, buffer); + if (length <= MAX_PRINT_LEN) + debug_info_real(func, file, line, "printing %i bytes plist:\n%s", length, buffer); + else + debug_info_real(func, file, line, "supress printing %i bytes plist...\n", length); + free(buffer); #endif } -- cgit v1.1-32-gdbae