diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/debug.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/common/debug.c b/common/debug.c index 8ad0f08..c4d3897 100644 --- a/common/debug.c +++ b/common/debug.c | |||
| @@ -41,19 +41,6 @@ | |||
| 41 | 41 | ||
| 42 | #define MAX_PRINT_LEN 16*1024 | 42 | #define MAX_PRINT_LEN 16*1024 |
| 43 | 43 | ||
| 44 | int debug_level = 0; | ||
| 45 | |||
| 46 | /** | ||
| 47 | * Sets the level of debugging. Currently the only acceptable values are 0 and | ||
| 48 | * 1. | ||
| 49 | * | ||
| 50 | * @param level Set to 0 for no debugging or 1 for debugging. | ||
| 51 | */ | ||
| 52 | LIBIMOBILEDEVICE_API void idevice_set_debug_level(int level) | ||
| 53 | { | ||
| 54 | debug_level = level; | ||
| 55 | } | ||
| 56 | |||
| 57 | #ifndef STRIP_DEBUG_CODE | 44 | #ifndef STRIP_DEBUG_CODE |
| 58 | static void debug_print_line(const char *func, const char *file, int line, const char *buffer) | 45 | static void debug_print_line(const char *func, const char *file, int line, const char *buffer) |
| 59 | { | 46 | { |
| @@ -90,7 +77,7 @@ void debug_info_real(const char *func, const char *file, int line, const char *f | |||
| 90 | va_list args; | 77 | va_list args; |
| 91 | char *buffer = NULL; | 78 | char *buffer = NULL; |
| 92 | 79 | ||
| 93 | if (!debug_level) | 80 | if (!idevice_debug_level) |
| 94 | return; | 81 | return; |
| 95 | 82 | ||
| 96 | /* run the real fprintf */ | 83 | /* run the real fprintf */ |
| @@ -111,7 +98,7 @@ void debug_buffer(const char *data, const int length) | |||
| 111 | int j; | 98 | int j; |
| 112 | unsigned char c; | 99 | unsigned char c; |
| 113 | 100 | ||
| 114 | if (debug_level) { | 101 | if (idevice_debug_level) { |
| 115 | for (i = 0; i < length; i += 16) { | 102 | for (i = 0; i < length; i += 16) { |
| 116 | fprintf(stderr, "%04x: ", i); | 103 | fprintf(stderr, "%04x: ", i); |
| 117 | for (j = 0; j < 16; j++) { | 104 | for (j = 0; j < 16; j++) { |
| @@ -142,7 +129,7 @@ void debug_buffer(const char *data, const int length) | |||
| 142 | void debug_buffer_to_file(const char *file, const char *data, const int length) | 129 | void debug_buffer_to_file(const char *file, const char *data, const int length) |
| 143 | { | 130 | { |
| 144 | #ifndef STRIP_DEBUG_CODE | 131 | #ifndef STRIP_DEBUG_CODE |
| 145 | if (debug_level) { | 132 | if (idevice_debug_level) { |
| 146 | FILE *f = fopen(file, "wb"); | 133 | FILE *f = fopen(file, "wb"); |
| 147 | fwrite(data, 1, length, f); | 134 | fwrite(data, 1, length, f); |
| 148 | fflush(f); | 135 | fflush(f); |
