[libvirt] [libvirt-glib 3/3] Only call gvir_error_new after failed libvirt calls

Christophe Fergeau cfergeau at redhat.com
Thu Oct 6 18:24:12 UTC 2011


gvir_error_new is only meant to be used right after a failed
libvirt function call, in other cases we should be calling
g_error_new directly.
---
 libvirt-gobject/libvirt-gobject-connection.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index 95cd878..70b7411 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -583,9 +583,9 @@ gboolean gvir_connection_fetch_domains(GVirConnection *conn,
 
     g_mutex_lock(priv->lock);
     if (!priv->conn) {
-        *err = gvir_error_new(GVIR_CONNECTION_ERROR,
-                              0,
-                              "Connection is not open");
+        *err = g_error_new(GVIR_CONNECTION_ERROR,
+                           0,
+                           "Connection is not open");
         g_mutex_unlock(priv->lock);
         goto cleanup;
     }
@@ -708,9 +708,9 @@ gboolean gvir_connection_fetch_storage_pools(GVirConnection *conn,
 
     g_mutex_lock(priv->lock);
     if (!priv->conn) {
-        *err = gvir_error_new(GVIR_CONNECTION_ERROR,
-                              0,
-                              "Connection is not open");
+        *err = g_error_new(GVIR_CONNECTION_ERROR,
+                           0,
+                           "Connection is not open");
         g_mutex_unlock(priv->lock);
         goto cleanup;
     }
-- 
1.7.6.4




More information about the libvir-list mailing list