core: Minor code cleanup in libusb_init (NOP)
authorTormod Volden <debian.tormod@gmail.com>
Tue, 9 Nov 2021 08:57:57 +0000 (09:57 +0100)
committerTormod Volden <debian.tormod@gmail.com>
Tue, 9 Nov 2021 09:05:38 +0000 (10:05 +0100)
After commit f7084fe the if clause would always be true, so remove it.

Thanks to "xloem" for reporting.

References #942

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
libusb/core.c
libusb/version_nano.h

index 03acdd8..7976e4c 100644 (file)
@@ -2319,16 +2319,14 @@ int API_EXPORTED libusb_init(libusb_context **ctx)
        list_init(&_ctx->usb_devs);
        list_init(&_ctx->open_devs);
 
-       /* apply options to new contexts (also default context being created) */
-       if (ctx || !usbi_default_context) {
-               for (enum libusb_option option = 0 ; option < LIBUSB_OPTION_MAX ; option++) {
-                       if (LIBUSB_OPTION_LOG_LEVEL == option || !default_context_options[option].is_set) {
-                               continue;
-                       }
-                       r = libusb_set_option(_ctx, option);
-                       if (LIBUSB_SUCCESS != r)
-                               goto err_free_ctx;
+       /* apply default options to all new contexts */
+       for (enum libusb_option option = 0 ; option < LIBUSB_OPTION_MAX ; option++) {
+               if (LIBUSB_OPTION_LOG_LEVEL == option || !default_context_options[option].is_set) {
+                       continue;
                }
+               r = libusb_set_option(_ctx, option);
+               if (LIBUSB_SUCCESS != r)
+                       goto err_free_ctx;
        }
 
        /* default context must be initialized before calling usbi_dbg */
index 09d6e2e..ee61cdd 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11674
+#define LIBUSB_NANO 11675