[Spice-devel] [spice-gtk PATCH v1 11/13] log: use spice_error instead of g_error

Victor Toso victortoso at redhat.com
Fri Dec 11 07:54:57 PST 2015


---
 src/channel-usbredir.c    | 2 +-
 src/continuation.c        | 3 ++-
 src/coroutine.h           | 1 +
 src/coroutine_gthread.c   | 2 +-
 src/coroutine_ucontext.c  | 4 ++--
 src/coroutine_winfibers.c | 4 ++--
 src/spice-gtk-session.c   | 2 +-
 src/spice-widget.c        | 2 +-
 src/usb-device-manager.c  | 6 +++---
 src/usb-device-widget.c   | 2 +-
 10 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index d1e9673..418f32a 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -226,7 +226,7 @@ void spice_usbredir_channel_set_context(SpiceUsbredirChannel *channel,
                                    spice_util_get_debug() ? usbredirparser_debug : usbredirparser_warning,
                                    usbredirhost_fl_write_cb_owns_buffer);
     if (!priv->host)
-        g_error("Out of memory allocating usbredirhost");
+        spice_error("Out of memory allocating usbredirhost");
 
 #if USBREDIR_VERSION >= 0x000701
     usbredirhost_set_buffered_output_size_cb(priv->host, usbredir_buffered_output_size_callback);
diff --git a/src/continuation.c b/src/continuation.c
index adce858..1cdd0d1 100644
--- a/src/continuation.c
+++ b/src/continuation.c
@@ -28,6 +28,7 @@
 #include <glib.h>
 
 #include "continuation.h"
+#include "common/log.h"
 
 /*
  * va_args to makecontext() must be type 'int', so passing
@@ -60,7 +61,7 @@ void cc_init(struct continuation *cc)
 	volatile union cc_arg arg;
 	arg.p = cc;
 	if (getcontext(&cc->uc) == -1)
-		g_error("getcontext() failed: %s", g_strerror(errno));
+		spice_error("getcontext() failed: %s", g_strerror(errno));
 	cc->uc.uc_link = &cc->last;
 	cc->uc.uc_stack.ss_sp = cc->stack;
 	cc->uc.uc_stack.ss_size = cc->stack_size;
diff --git a/src/coroutine.h b/src/coroutine.h
index 78dc467..c9694a8 100644
--- a/src/coroutine.h
+++ b/src/coroutine.h
@@ -22,6 +22,7 @@
 #define _COROUTINE_H_
 
 #include "config.h"
+#include "common/log.h"
 
 #if WITH_UCONTEXT
 #include "continuation.h"
diff --git a/src/coroutine_gthread.c b/src/coroutine_gthread.c
index b0098fa..abf149b 100644
--- a/src/coroutine_gthread.c
+++ b/src/coroutine_gthread.c
@@ -99,7 +99,7 @@ void coroutine_init(struct coroutine *co)
 					  G_THREAD_PRIORITY_NORMAL,
 					  &err);
 	if (err != NULL)
-		g_error("g_thread_create_full() failed: %s", err->message);
+		spice_error("g_thread_create_full() failed: %s", err->message);
 
 	co->exited = 0;
 	co->runnable = FALSE;
diff --git a/src/coroutine_ucontext.c b/src/coroutine_ucontext.c
index d709a33..84499dc 100644
--- a/src/coroutine_ucontext.c
+++ b/src/coroutine_ucontext.c
@@ -74,8 +74,8 @@ void coroutine_init(struct coroutine *co)
 			    MAP_PRIVATE | MAP_ANONYMOUS,
 			    -1, 0);
 	if (co->cc.stack == MAP_FAILED)
-		g_error("mmap(%" G_GSIZE_FORMAT ") failed: %s",
-			co->stack_size, g_strerror(errno));
+		spice_error("mmap(%" G_GSIZE_FORMAT ") failed: %s",
+			    co->stack_size, g_strerror(errno));
 
 	co->cc.entry = coroutine_trampoline;
 	co->cc.release = _coroutine_release;
diff --git a/src/coroutine_winfibers.c b/src/coroutine_winfibers.c
index a56d33d..dcd745d 100644
--- a/src/coroutine_winfibers.c
+++ b/src/coroutine_winfibers.c
@@ -57,13 +57,13 @@ void coroutine_init(struct coroutine *co)
 	if (leader.fiber == NULL) {
 		leader.fiber = ConvertThreadToFiber(&leader);
 		if (leader.fiber == NULL)
-			g_error("ConvertThreadToFiber() failed");
+			spice_error("ConvertThreadToFiber() failed");
 	}
 
 	co->exited = 0;
 	co->fiber = CreateFiber(0, &coroutine_trampoline, co);
 	if (co->fiber == NULL)
-		g_error("CreateFiber() failed");
+		spice_error("CreateFiber() failed");
 
 	co->ret = 0;
 }
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 22e4033..5b510d2 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -246,7 +246,7 @@ spice_gtk_session_constructor(GType                  gtype,
     self = SPICE_GTK_SESSION(obj);
     s = self->priv;
     if (!s->session)
-        g_error("SpiceGtKSession constructed without a session");
+        spice_error("SpiceGtKSession constructed without a session");
 
     g_signal_connect(s->session, "channel-new",
                      G_CALLBACK(channel_new), self);
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 7be0770..a889076 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -606,7 +606,7 @@ spice_display_constructor(GType                  gtype,
     d = display->priv;
 
     if (!d->session)
-        g_error("SpiceDisplay constructed without a session");
+        spice_error("SpiceDisplay constructed without a session");
 
     spice_g_signal_connect_object(d->session, "channel-new",
                                   G_CALLBACK(channel_new), display, 0);
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index a9656e3..95f7d78 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -420,7 +420,7 @@ static void spice_usb_device_manager_set_property(GObject       *gobject,
         r = usbredirfilter_string_to_rules(filter, ",", "|", &rules, &count);
         if (r) {
             if (r == -ENOMEM)
-                g_error("Failed to allocate memory for auto-connect-filter");
+                spice_error("Failed to allocate memory for auto-connect-filter");
             spice_warning("Error parsing auto-connect-filter string, keeping old filter");
             break;
         }
@@ -445,7 +445,7 @@ static void spice_usb_device_manager_set_property(GObject       *gobject,
                                                &rules, &count);
         if (r) {
             if (r == -ENOMEM)
-                g_error("Failed to allocate memory for redirect-on-connect");
+                spice_error("Failed to allocate memory for redirect-on-connect");
             spice_warning("Error parsing redirect-on-connect string, keeping old filter");
             break;
         }
@@ -1332,7 +1332,7 @@ GPtrArray* spice_usb_device_manager_get_devices_with_filter(
         r = usbredirfilter_string_to_rules(filter, ",", "|", &rules, &count);
         if (r) {
             if (r == -ENOMEM)
-                g_error("Failed to allocate memory for filter");
+                spice_error("Failed to allocate memory for filter");
             spice_warning("Error parsing filter, ignoring");
             rules = NULL;
             count = 0;
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index f0cff7b..d757698 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -195,7 +195,7 @@ static GObject *spice_usb_device_widget_constructor(
     self = SPICE_USB_DEVICE_WIDGET(obj);
     priv = self->priv;
     if (!priv->session)
-        g_error("SpiceUsbDeviceWidget constructed without a session");
+        spice_error("SpiceUsbDeviceWidget constructed without a session");
 
     label = gtk_label_new(NULL);
     str = g_strdup_printf("<b>%s</b>", _("Select USB devices to redirect"));
-- 
2.5.0



More information about the Spice-devel mailing list