[Spice-devel] [PATCH spice-gtk 3/7] usb-device-manager: Put all Unix code in spice_usb_device_manager_initable_init together
Frediano Ziglio
fziglio at redhat.com
Thu Jul 11 13:00:50 UTC 2019
This reduces conditional code.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
src/usb-device-manager.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
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;
--
2.20.1
More information about the Spice-devel
mailing list