[libvirt-python PATCH 04/23] drop unnecessary goto

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 libvirt-override.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/libvirt-override.c b/libvirt-override.c
index 114104b..b18196f 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -476,27 +476,22 @@ cleanup:
  */
 static int
 getPyNodeCPUCount(virConnectPtr conn) {
-    int i_retval = -1;
+    int i_retval;
     virNodeInfo nodeinfo;
 
 #if LIBVIR_CHECK_VERSION(1, 0, 0)
     LIBVIRT_BEGIN_ALLOW_THREADS;
     i_retval = virNodeGetCPUMap(conn, NULL, NULL, 0);
     LIBVIRT_END_ALLOW_THREADS;
-#endif /* LIBVIR_CHECK_VERSION(1, 0, 0) */
-
-    if (i_retval < 0) {
-        /* fallback: use nodeinfo */
-        LIBVIRT_BEGIN_ALLOW_THREADS;
-        i_retval = virNodeGetInfo(conn, &nodeinfo);
-        LIBVIRT_END_ALLOW_THREADS;
-        if (i_retval < 0)
-            goto cleanup;
+#else /* fallback: use nodeinfo */
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    i_retval = virNodeGetInfo(conn, &nodeinfo);
+    LIBVIRT_END_ALLOW_THREADS;
 
+    if (i_retval >= 0)
         i_retval = VIR_NODEINFO_MAXCPUS(nodeinfo);
-    }
+#endif /* LIBVIR_CHECK_VERSION(1, 0, 0) */
 
-cleanup:
     return i_retval;
 }
 
-- 
2.5.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]