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

[libvirt] [PATCH] API: Share code between virConnectOpen functions



From: Eduardo Lima (Etrunko) <eblima br ibm com>

Signed-off-by: Eduardo Lima (Etrunko) <eblima br ibm com>
---
 src/libvirt.c |   30 ++----------------------------
 1 files changed, 2 insertions(+), 28 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 68074e7..ca7a9a2 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1341,20 +1341,7 @@ failed:
 virConnectPtr
 virConnectOpen (const char *name)
 {
-    virConnectPtr ret = NULL;
-    if (!initialized)
-        if (virInitialize() < 0)
-            goto error;
-
-    VIR_DEBUG("name=%s", name);
-    ret = do_open (name, NULL, 0);
-    if (!ret)
-        goto error;
-    return ret;
-
-error:
-    virDispatchError(NULL);
-    return NULL;
+    return virConnectOpenAuth(name, NULL, 0);
 }
 
 /**
@@ -1375,20 +1362,7 @@ error:
 virConnectPtr
 virConnectOpenReadOnly(const char *name)
 {
-    virConnectPtr ret = NULL;
-    if (!initialized)
-        if (virInitialize() < 0)
-            goto error;
-
-    VIR_DEBUG("name=%s", name);
-    ret = do_open (name, NULL, VIR_CONNECT_RO);
-    if (!ret)
-        goto error;
-    return ret;
-
-error:
-    virDispatchError(NULL);
-    return NULL;
+    return virConnectOpenAuth(name, NULL, VIR_CONNECT_RO);
 }
 
 /**
-- 
1.7.4.4


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