diff options
author | Toby Gray <toby.gray@realvnc.com> | 2013-06-27 14:49:21 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-06-27 17:10:38 +0200 |
commit | fb4c208c33788068bbca67bdd6d11127b5be5a26 (patch) | |
tree | 959e65a2e2e8f9b557f6936a7fc00b493b484ecc /libusb/libusbi.h | |
parent | e2c54d93b1fd89517b75e6761fad72f7c35532ad (diff) | |
download | android_external_libusbx-fb4c208c33788068bbca67bdd6d11127b5be5a26.tar.gz android_external_libusbx-fb4c208c33788068bbca67bdd6d11127b5be5a26.tar.bz2 android_external_libusbx-fb4c208c33788068bbca67bdd6d11127b5be5a26.zip |
Core: Make writing of log lines a single fprintf call.
Prior to this change a single line of logging performing several fprintf.
This change gets all the data for a line to be logged in a single
fprintf call. This reduced the chances of writes from another thread
getting intermixed with a log line.
It also makes it easier to change where logs are output to in the future.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'libusb/libusbi.h')
-rw-r--r-- | libusb/libusbi.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libusb/libusbi.h b/libusb/libusbi.h index c9b402d..7293901 100644 --- a/libusb/libusbi.h +++ b/libusb/libusbi.h @@ -56,6 +56,11 @@ #define USBI_CAP_HAS_HID_ACCESS 0x00010000 #define USBI_CAP_SUPPORTS_DETACH_KERNEL_DRIVER 0x00020000 +/* Maximum number of bytes in a log line */ +#define USBI_MAX_LOG_LEN 256 +/* Terminator for log lines */ +#define USBI_LOG_LINE_END "\n" + /* The following is used to silence warnings for unused variables */ #define UNUSED(var) do { (void)(var); } while(0) @@ -447,6 +452,11 @@ int usbi_gettimeofday(struct timeval *tp, void *tzp); #endif #endif +#if (defined(OS_WINDOWS) || defined(OS_WINCE)) && !defined(__GCC__) +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#endif + struct usbi_pollfd { /* must come first */ struct libusb_pollfd pollfd; |