[Spice-devel] [PATCH spice-gtk 13/14] usb: do not return GError on programmer pre-condition checks

Marc-André Lureau marcandre.lureau at gmail.com
Wed Apr 23 11:09:18 PDT 2014


Use regular g_warn/g_return precondition checks.

Do not fail on errors that can be ignored, but warn instead.
---
 gtk/usb-device-manager.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 81e3c80..ec19564 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -244,20 +244,11 @@ static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
     g_return_val_if_fail(SPICE_IS_USB_DEVICE_MANAGER(initable), FALSE);
     g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
 
-    if (cancellable != NULL) {
-        g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
-                            "Cancellable initialization not supported");
-        return FALSE;
-    }
-
     self = SPICE_USB_DEVICE_MANAGER(initable);
     priv = self->priv;
 
-    if (!priv->session) {
-        g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
-                "SpiceUsbDeviceManager constructed without a session");
-        return FALSE;
-    }
+    g_warn_if_fail(cancellable == NULL);
+    g_return_val_if_fail(priv->session, FALSE);
 
 #ifdef USE_USBREDIR
 
-- 
1.8.5.3



More information about the Spice-devel mailing list