[PATCH spice-gtk 2/7] usb-device-manager: Reduce some conditional code handling !USE_USBREDIR first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 479558f4..0a979210 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -213,19 +213,15 @@ G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device, g_object_ref, g_object_unr
  */
 gboolean spice_usb_device_manager_is_redirecting(SpiceUsbDeviceManager *self)
 {
-#ifdef USE_USBREDIR
-
-#ifdef G_OS_WIN32
+#ifndef USE_USBREDIR
+    return FALSE;
+#elif defined(G_OS_WIN32)
     gboolean redirecting;
     g_object_get(self->priv->udev, "redirecting", &redirecting, NULL);
     return redirecting;
 #else
     return self->priv->redirecting;
 #endif
-
-#else
-    return FALSE;
-#endif
 }
 
 static void spice_usb_device_manager_initable_iface_init(GInitableIface *iface);
@@ -261,7 +257,11 @@ static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
                                                        GCancellable  *cancellable,
                                                        GError        **err)
 {
-#ifdef USE_USBREDIR
+#ifndef USE_USBREDIR
+    g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
+                        _("USB redirection support not compiled in"));
+    return FALSE;
+#else
     SpiceUsbDeviceManager *self = SPICE_USB_DEVICE_MANAGER(initable);
     SpiceUsbDeviceManagerPrivate *priv = self->priv;
     GList *list;
@@ -306,10 +306,6 @@ static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
     g_list_free(list);
 
     return TRUE;
-#else
-    g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
-                        _("USB redirection support not compiled in"));
-    return FALSE;
 #endif
 }
 
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]