summaryrefslogtreecommitdiff
path: root/libusb/libusbi.h
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@google.com>2021-07-20 09:31:06 -0600
committerNathan Hjelm <hjelmn@cs.unm.edu>2021-07-21 10:03:59 -0600
commit6cae9c6dbd74c0840848f343dd605c5ddcef1ad1 (patch)
tree05ab9c50bbafcf66d00f866f99a31126aa2866a3 /libusb/libusbi.h
parentb0fd4d873e224bbb1985971834d31d956080c7a4 (diff)
downloadlibusb-6cae9c6dbd74c0840848f343dd605c5ddcef1ad1.tar.gz
core: update usbi_dbg to take the context as an argument
This commit fixes a performance issue caused by the disconnection of the first context allocated from the default context. usbi_dbg now takes the explicit context instead of relying on the default context (which may not exist) in most cases. All call sites have been updated to pass the context or explicitly pass NULL if the context is not available. We should actively discourage using NULL as the context in the future and patch all call sites to always pass the context. Fixes #951 Signed-off-by: Nathan Hjelm <hjelmn@google.com>
Diffstat (limited to 'libusb/libusbi.h')
-rw-r--r--libusb/libusbi.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index 31d4917..158a9af 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -317,14 +317,14 @@ void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
#define usbi_err(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_ERROR, __VA_ARGS__)
#define usbi_warn(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_WARNING, __VA_ARGS__)
#define usbi_info(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_INFO, __VA_ARGS__)
-#define usbi_dbg(...) _usbi_log(NULL, LIBUSB_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#define usbi_dbg(ctx ,...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_DEBUG, __VA_ARGS__)
#else /* ENABLE_LOGGING */
#define usbi_err(ctx, ...) UNUSED(ctx)
#define usbi_warn(ctx, ...) UNUSED(ctx)
#define usbi_info(ctx, ...) UNUSED(ctx)
-#define usbi_dbg(...) do {} while (0)
+#define usbi_dbg(ctx, ...) do {} while (0)
#endif /* ENABLE_LOGGING */