[PATCH 4/7] Remove useless variable in qemuDomainAssignAddresses

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

 



We do not need to propagate the exact return values
and the only possible ones are 0 and -1 anyway.

Remove the temporary variable and use the usual pattern:

if (f() < 0)
    return -1;
---
 src/qemu/qemu_domain_address.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index f149ff9..25aab39 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1644,23 +1644,21 @@ qemuDomainAssignAddresses(virDomainDefPtr def,
                           virQEMUCapsPtr qemuCaps,
                           virDomainObjPtr obj)
 {
-    int rc;
-
-    rc = qemuDomainAssignVirtioSerialAddresses(def, obj);
-    if (rc)
-        return rc;
+    if (qemuDomainAssignVirtioSerialAddresses(def, obj) < 0)
+        return -1;
 
-    rc = qemuDomainAssignSpaprVIOAddresses(def, qemuCaps);
-    if (rc)
-        return rc;
+    if (qemuDomainAssignSpaprVIOAddresses(def, qemuCaps) < 0)
+        return -1;
 
-    rc = qemuDomainAssignS390Addresses(def, qemuCaps, obj);
-    if (rc)
-        return rc;
+    if (qemuDomainAssignS390Addresses(def, qemuCaps, obj) < 0)
+        return -1;
 
     qemuDomainAssignARMVirtioMMIOAddresses(def, qemuCaps);
 
-    return qemuDomainAssignPCIAddresses(def, qemuCaps, obj);
+    if (qemuDomainAssignPCIAddresses(def, qemuCaps, obj) < 0)
+        return -1;
+
+    return 0;
 }
 
 
-- 
2.7.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]