diff options
Diffstat (limited to 'common/debug.c')
-rw-r--r-- | common/debug.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/common/debug.c b/common/debug.c index acca456..cf1bc2f 100644 --- a/common/debug.c +++ b/common/debug.c @@ -31,9 +31,9 @@ #include <stdlib.h> #include <time.h> +#include "src/idevice.h" #include "debug.h" #include "libimobiledevice/libimobiledevice.h" -#include "src/idevice.h" #ifndef STRIP_DEBUG_CODE #include "asprintf.h" @@ -46,7 +46,7 @@ void internal_set_debug_level(int level) debug_level = level; } -#define MAX_PRINT_LEN 16*1024 +#define MAX_PRINT_LEN (16*1024) #ifndef STRIP_DEBUG_CODE static void debug_print_line(const char *func, const char *file, int line, const char *buffer) @@ -60,19 +60,16 @@ static void debug_print_line(const char *func, const char *file, int line, const strftime(str_time, 254, "%H:%M:%S", localtime (&the_time)); /* generate header text */ - (void)asprintf(&header, "%s %s:%d %s()", str_time, file, line, func); + if(asprintf(&header, "%s %s:%d %s()", str_time, file, line, func)<0){} free (str_time); /* trim ending newlines */ /* print header */ - printf ("%s: ", header); + fprintf(stderr, "%s: ", header); /* print actual debug content */ - printf ("%s\n", buffer); - - /* flush this output, as we need to debug */ - fflush (stdout); + fprintf(stderr, "%s\n", buffer); free (header); } @@ -89,7 +86,7 @@ void debug_info_real(const char *func, const char *file, int line, const char *f /* run the real fprintf */ va_start(args, format); - (void)vasprintf(&buffer, format, args); + if(vasprintf(&buffer, format, args)<0){} va_end(args); debug_print_line(func, file, line, buffer); |