diff options
| author | 2009-04-13 08:48:00 -0700 | |
|---|---|---|
| committer | 2009-04-13 08:48:00 -0700 | |
| commit | 6671ca3d6de6a1fd27853e3b1ce7a81d568703f0 (patch) | |
| tree | 735c5ace7ed57cd4e19f2fde423b22e6104eaa98 /src/utils.c | |
| parent | bd31783d7fde0b5bd101f4a3f97ca1aca2aa6fab (diff) | |
| parent | 288929f45cb2641690879b52ec514097995cd41a (diff) | |
| download | libimobiledevice-6671ca3d6de6a1fd27853e3b1ce7a81d568703f0.tar.gz libimobiledevice-6671ca3d6de6a1fd27853e3b1ce7a81d568703f0.tar.bz2 | |
Merged in Jonathan's libplist libiphone. [#2 state:resolved]
Diffstat (limited to 'src/utils.c')
| -rw-r--r-- | src/utils.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index fb98471..5b0872d 100644 --- a/src/utils.c +++ b/src/utils.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include "utils.h" | 23 | #include "utils.h" |
| 24 | 24 | ||
| 25 | int toto_debug = 0; | 25 | int toto_debug = 0; |
| 26 | uint16_t dbg_mask = 0; | ||
| 26 | 27 | ||
| 27 | /** | 28 | /** |
| 28 | * Sets the level of debugging. Currently the only acceptable values are 0 and | 29 | * Sets the level of debugging. Currently the only acceptable values are 0 and |
| @@ -36,6 +37,15 @@ void iphone_set_debug(int level) | |||
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | 39 | ||
| 40 | /** | ||
| 41 | * Set debug ids to display. Values can be OR-ed | ||
| 42 | * | ||
| 43 | * @param level Set to 0 for no debugging or 1 for debugging. | ||
| 44 | */ | ||
| 45 | void iphone_set_debug_mask(uint16_t mask) | ||
| 46 | { | ||
| 47 | dbg_mask = mask; | ||
| 48 | } | ||
| 39 | 49 | ||
| 40 | void log_debug_msg(const char *format, ...) | 50 | void log_debug_msg(const char *format, ...) |
| 41 | { | 51 | { |
| @@ -53,6 +63,21 @@ void log_debug_msg(const char *format, ...) | |||
| 53 | #endif | 63 | #endif |
| 54 | } | 64 | } |
| 55 | 65 | ||
| 66 | void log_dbg_msg(uint16_t id, const char *format, ...) | ||
| 67 | { | ||
| 68 | #ifndef STRIP_DEBUG_CODE | ||
| 69 | if (id & dbg_mask) { | ||
| 70 | va_list args; | ||
| 71 | /* run the real fprintf */ | ||
| 72 | va_start(args, format); | ||
| 73 | |||
| 74 | vfprintf(stderr, format, args); | ||
| 75 | |||
| 76 | va_end(args); | ||
| 77 | } | ||
| 78 | #endif | ||
| 79 | } | ||
| 80 | |||
| 56 | inline void log_debug_buffer(const char *data, const int length) | 81 | inline void log_debug_buffer(const char *data, const int length) |
| 57 | { | 82 | { |
| 58 | #ifndef STRIP_DEBUG_CODE | 83 | #ifndef STRIP_DEBUG_CODE |
