[PATCH v2 7/7] virsh: domain: remove else branch

Kristina Hanicova khanicov at redhat.com
Fri Sep 24 15:17:50 UTC 2021


I removed else branches after return/break as they are not
necessary and the code looks cleaner without them.

Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
---
 tools/virsh-domain.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 94ed786751..ca8f08d949 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11046,12 +11046,12 @@ cmdMigrateCompCache(vshControl *ctl, const vshCmd *cmd)
         return false;
 
     rc = vshCommandOptULongLong(ctl, cmd, "size", &size);
-    if (rc < 0) {
+    if (rc < 0)
+        return false;
+
+    if (rc != 0 &&
+        (virDomainMigrateSetCompressionCache(dom, size, 0) < 0))
         return false;
-    } else if (rc != 0) {
-        if (virDomainMigrateSetCompressionCache(dom, size, 0) < 0)
-            return false;
-    }
 
     if (virDomainMigrateGetCompressionCache(dom, &size, 0) < 0)
         return false;
@@ -11432,11 +11432,9 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
 
         /* We got what we came for so return successfully */
         ret = true;
-        if (!all) {
+        if (!all)
             break;
-        } else {
-            vshPrint(ctl, "\n");
-        }
+        vshPrint(ctl, "\n");
     }
 
     if (!ret) {
-- 
2.31.1




More information about the libvir-list mailing list