diff options
| author | Chris Dickens <christopher.a.dickens@gmail.com> | 2017-07-12 11:29:37 -0700 |
|---|---|---|
| committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2017-07-12 11:29:37 -0700 |
| commit | 34987d005ec6a49cef89dde76513db34a4731bae (patch) | |
| tree | 19e824deea4c65d119c823ddb21d6bae9fe403ba /libusb/libusbi.h | |
| parent | a1cf206218b0cd69b04d0f7bf4ec440e14f9becf (diff) | |
| download | platform_external_libusb-34987d005ec6a49cef89dde76513db34a4731bae.tar.gz platform_external_libusb-34987d005ec6a49cef89dde76513db34a4731bae.tar.bz2 platform_external_libusb-34987d005ec6a49cef89dde76513db34a4731bae.zip | |
core: Slightly refactor and improve logging code
This change refactors the code that reads the LIBUSB_DEBUG environment
variable into a function to avoid code duplication and ensure that the
value is coerced into a valid libusb_log_level value.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/libusbi.h')
| -rw-r--r-- | libusb/libusbi.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libusb/libusbi.h b/libusb/libusbi.h index 9e364ca..2818125 100644 --- a/libusb/libusbi.h +++ b/libusb/libusbi.h @@ -178,6 +178,9 @@ static inline void *usbi_reallocf(void *ptr, size_t size) const typeof( ((type *)0)->member ) *mptr = (ptr); \ (type *)( (char *)mptr - offsetof(type,member) );}) +#ifndef CLAMP +#define CLAMP(val, min, max) ((val) < (min) ? (min) : ((val) > (max) ? (max) : (val))) +#endif #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif @@ -288,7 +291,7 @@ struct pollfd; struct libusb_context { #if defined(ENABLE_LOGGING) && !defined(ENABLE_DEBUG_LOGGING) - int debug; + enum libusb_log_level debug; int debug_fixed; #endif |
