[PATCH 3/5] libvirt_nss: Drop some needless cleanup labels

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

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tools/nss/libvirt_nss.c | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index e55bf144bc..3b2583669b 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -85,7 +85,6 @@ appendAddr(leaseAddress **tmpAddress,
            virJSONValuePtr lease,
            int af)
 {
-    int ret = -1;
     const char *ipAddr;
     virSocketAddr sa;
     int family;
@@ -93,21 +92,20 @@ appendAddr(leaseAddress **tmpAddress,
 
     if (!(ipAddr = virJSONValueObjectGetString(lease, "ip-address"))) {
         ERROR("ip-address field missing for %s", name);
-        goto cleanup;
+        return -1;
     }
 
     DEBUG("IP address: %s", ipAddr);
 
     if (virSocketAddrParse(&sa, ipAddr, AF_UNSPEC) < 0) {
         ERROR("Unable to parse %s", ipAddr);
-        goto cleanup;
+        return -1;
     }
 
     family = VIR_SOCKET_ADDR_FAMILY(&sa);
     if (af != AF_UNSPEC && af != family) {
         DEBUG("Skipping address which family is %d, %d requested", family, af);
-        ret = 0;
-        goto cleanup;
+        return 0;
     }
 
     for (i = 0; i < *ntmpAddress; i++) {
@@ -117,14 +115,13 @@ appendAddr(leaseAddress **tmpAddress,
                     (void *) &sa.data.inet6.sin6_addr.s6_addr),
                    FAMILY_ADDRESS_SIZE(family)) == 0) {
             DEBUG("IP address already in the list");
-            ret = 0;
-            goto cleanup;
+            return 0;
         }
     }
 
     if (VIR_REALLOC_N_QUIET(*tmpAddress, *ntmpAddress + 1) < 0) {
         ERROR("Out of memory");
-        goto cleanup;
+        return -1;
     }
 
     (*tmpAddress)[*ntmpAddress].af = family;
@@ -134,9 +131,7 @@ appendAddr(leaseAddress **tmpAddress,
             (void *) &sa.data.inet6.sin6_addr.s6_addr),
            FAMILY_ADDRESS_SIZE(family));
     (*ntmpAddress)++;
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -153,11 +148,10 @@ findLeaseInJSON(leaseAddress **tmpAddress,
     size_t i;
     long long expirytime;
     time_t currtime;
-    int ret = -1;
 
     if ((currtime = time(NULL)) == (time_t) - 1) {
         ERROR("Failed to get current system time");
-        goto cleanup;
+        return -1;
     }
 
     for (i = 0; i < nleases; i++) {
@@ -166,7 +160,7 @@ findLeaseInJSON(leaseAddress **tmpAddress,
         if (!lease) {
             /* This should never happen (TM) */
             ERROR("Unable to get element %zu of %zu", i, nleases);
-            goto cleanup;
+            return -1;
         }
 
         if (macs) {
@@ -190,7 +184,7 @@ findLeaseInJSON(leaseAddress **tmpAddress,
         if (virJSONValueObjectGetNumberLong(lease, "expiry-time", &expirytime) < 0) {
             /* A lease cannot be present without expiry-time */
             ERROR("expiry-time field missing for %s", name);
-            goto cleanup;
+            return -1;
         }
 
         /* Do not report expired lease */
@@ -203,12 +197,10 @@ findLeaseInJSON(leaseAddress **tmpAddress,
         *found = true;
 
         if (appendAddr(tmpAddress, ntmpAddress, lease, af) < 0)
-            goto cleanup;
+            return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
-- 
2.21.0

--
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]

  Powered by Linux