[spice-gtk,3/7] usb-device-manager: Put all Unix code in spice_usb_device_manager_initable_init together

Submitted by Frediano Ziglio on July 11, 2019, 1 p.m.

Details

Message ID 20190711130054.17867-3-fziglio@redhat.com
State Accepted
Commit 0bad866a2efd7b2a71c8ec3ee47414067745a4d7
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio July 11, 2019, 1 p.m.
This reduces conditional code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 src/usb-device-manager.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 0a979210..4b126896 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -267,14 +267,6 @@  static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
     GList *list;
     GList *it;
 
-#ifndef G_OS_WIN32
-    /* Initialize libusb */
-    priv->context = spice_usb_backend_new(err);
-    if (!priv->context) {
-        return FALSE;
-    }
-#endif
-
     /* Start listening for usb devices plug / unplug */
 #ifdef G_OS_WIN32
     priv->udev = g_udev_client_new();
@@ -288,6 +280,12 @@  static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
     /* Do coldplug (detection of already connected devices) */
     g_udev_client_report_devices(priv->udev);
 #else
+    /* Initialize libusb */
+    priv->context = spice_usb_backend_new(err);
+    if (!priv->context) {
+        return FALSE;
+    }
+
     if (!spice_usb_backend_register_hotplug(priv->context, self,
                                             spice_usb_device_manager_hotplug_cb)) {
         return FALSE;