diff options
author | Pete Batard <pete@akeo.ie> | 2012-07-02 23:39:19 +0100 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2012-07-03 11:01:41 +0100 |
commit | 7ec94a45ed8155e7a1d4d5d75575099b09c78834 (patch) | |
tree | ac57151fceac382b0e80567f2563bb44efb88e91 /libusb/core.c | |
parent | 63f569be66a40a720bb797a87c3589f3e4de925a (diff) | |
download | libusbx-7ec94a45ed8155e7a1d4d5d75575099b09c78834.tar.gz |
Core: Prefix LOG_LEVEL_ with LIBUSB_ to avoid conflictsbaserock/morph
* The LOG_LEVEL_ enums, that were moved to the public API
in 933a319469bcccc962031c989e39d9d1f44f2885 may conflict
with applications/headers that also define their own
LOG_LEVEL_ values internally.
* As a matter of fact, as per Trac #31, this produces a
conflict with libusb-compat, as it defines its own levels.
Diffstat (limited to 'libusb/core.c')
-rw-r--r-- | libusb/core.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libusb/core.c b/libusb/core.c index 8845909..e10d808 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -1567,11 +1567,11 @@ int API_EXPORTED libusb_attach_kernel_driver(libusb_device_handle *dev, /** \ingroup lib * Set log message verbosity. * - * The default level is \ref LOG_LEVEL_NONE, which means no messages are ever + * The default level is LIBUSB_LOG_LEVEL_NONE, which means no messages are ever * printed. If you choose to increase the message verbosity level, ensure * that your application does not close the stdout/stderr file descriptors. * - * You are advised to use level \ref LOG_LEVEL_WARNING. libusbx is conservative + * You are advised to use level LIBUSB_LOG_LEVEL_WARNING. libusbx is conservative * with its message logging and most of the time, will only log messages that * explain error conditions and other oddities. This will help you debug * your software. @@ -1636,7 +1636,7 @@ int API_EXPORTED libusb_init(libusb_context **context) memset(ctx, 0, sizeof(*ctx)); #ifdef ENABLE_DEBUG_LOGGING - ctx->debug = LOG_LEVEL_DEBUG; + ctx->debug = LIBUSB_LOG_LEVEL_DEBUG; #endif dbg = getenv("LIBUSB_DEBUG"); @@ -1793,7 +1793,7 @@ int usbi_gettimeofday(struct timeval *tp, void *tzp) } #endif -void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level, +void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level, const char *function, const char *format, va_list args) { const char *prefix = ""; @@ -1807,14 +1807,14 @@ void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level, USBI_GET_CONTEXT(ctx); if (ctx == NULL) return; - global_debug = (ctx->debug == LOG_LEVEL_DEBUG); + global_debug = (ctx->debug == LIBUSB_LOG_LEVEL_DEBUG); if (!ctx->debug) return; - if (level == LOG_LEVEL_WARNING && ctx->debug < LOG_LEVEL_WARNING) + if (level == LIBUSB_LOG_LEVEL_WARNING && ctx->debug < LIBUSB_LOG_LEVEL_WARNING) return; - if (level == LOG_LEVEL_INFO && ctx->debug < LOG_LEVEL_INFO) + if (level == LIBUSB_LOG_LEVEL_INFO && ctx->debug < LIBUSB_LOG_LEVEL_INFO) return; - if (level == LOG_LEVEL_DEBUG && ctx->debug < LOG_LEVEL_DEBUG) + if (level == LIBUSB_LOG_LEVEL_DEBUG && ctx->debug < LIBUSB_LOG_LEVEL_DEBUG) return; #endif @@ -1832,19 +1832,19 @@ void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level, now.tv_usec -= timestamp_origin.tv_usec; switch (level) { - case LOG_LEVEL_INFO: + case LIBUSB_LOG_LEVEL_INFO: prefix = "info"; break; - case LOG_LEVEL_WARNING: + case LIBUSB_LOG_LEVEL_WARNING: prefix = "warning"; break; - case LOG_LEVEL_ERROR: + case LIBUSB_LOG_LEVEL_ERROR: prefix = "error"; break; - case LOG_LEVEL_DEBUG: + case LIBUSB_LOG_LEVEL_DEBUG: prefix = "debug"; break; - case LOG_LEVEL_NONE: + case LIBUSB_LOG_LEVEL_NONE: break; default: prefix = "unknown"; @@ -1863,7 +1863,7 @@ void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level, fprintf(stderr, "\n"); } -void usbi_log(struct libusb_context *ctx, enum usbi_log_level level, +void usbi_log(struct libusb_context *ctx, enum libusb_log_level level, const char *function, const char *format, ...) { va_list args; |