[PATCH 11/11] virsh: Remove needless labels

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

 



There are few places where a cleanup label contains nothing but a
return statement. Drop such labels and return directly.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tools/virsh-host.c | 20 ++++++--------------
 tools/vsh.c        | 11 ++++-------
 2 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 5ee3834de2..2e3cbc39b6 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -1195,7 +1195,6 @@ static bool
 cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
 {
     const char *from = NULL;
-    bool ret = false;
     int result;
     g_auto(GStrv) cpus = NULL;
     unsigned int flags = 0;
@@ -1219,7 +1218,7 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
     case VIR_CPU_COMPARE_INCOMPATIBLE:
         vshPrint(ctl, _("CPU described in %s is incompatible with host CPU\n"),
                  from);
-        goto cleanup;
+        return false;
         break;
 
     case VIR_CPU_COMPARE_IDENTICAL:
@@ -1235,13 +1234,10 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
     case VIR_CPU_COMPARE_ERROR:
     default:
         vshError(ctl, _("Failed to compare host CPU with %s"), from);
-        goto cleanup;
+        return false;
     }
 
-    ret = true;
-
- cleanup:
-    return ret;
+    return true;
 }
 
 /*
@@ -1615,7 +1611,6 @@ cmdHypervisorCPUCompare(vshControl *ctl,
     const char *emulator = NULL;
     const char *arch = NULL;
     const char *machine = NULL;
-    bool ret = false;
     int result;
     g_auto(GStrv) cpus = NULL;
     unsigned int flags = 0;
@@ -1646,7 +1641,7 @@ cmdHypervisorCPUCompare(vshControl *ctl,
                  _("CPU described in %s is incompatible with the CPU provided "
                    "by hypervisor on the host\n"),
                  from);
-        goto cleanup;
+        return false;
         break;
 
     case VIR_CPU_COMPARE_IDENTICAL:
@@ -1666,13 +1661,10 @@ cmdHypervisorCPUCompare(vshControl *ctl,
     case VIR_CPU_COMPARE_ERROR:
     default:
         vshError(ctl, _("Failed to compare hypervisor CPU with %s"), from);
-        goto cleanup;
+        return false;
     }
 
-    ret = true;
-
- cleanup:
-    return ret;
+    return true;
 }
 
 
diff --git a/tools/vsh.c b/tools/vsh.c
index e3e27a0ba6..c0098054e0 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -3360,7 +3360,6 @@ const vshCmdInfo info_complete[] = {
 bool
 cmdComplete(vshControl *ctl, const vshCmd *cmd)
 {
-    bool ret = false;
     const vshClientHooks *hooks = ctl->hooks;
     int stdin_fileno = STDIN_FILENO;
     const char *arg = "";
@@ -3370,7 +3369,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
     if (vshCommandOptStringQuiet(ctl, cmd, "string", &arg) <= 0)
-        goto cleanup;
+        return false;
 
     /* This command is flagged VSH_CMD_FLAG_NOCONNECT because we
      * need to prevent auth hooks reading any input. Therefore, we
@@ -3378,7 +3377,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
     VIR_FORCE_CLOSE(stdin_fileno);
 
     if (!(hooks && hooks->connHandler && hooks->connHandler(ctl)))
-        goto cleanup;
+        return false;
 
     while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
         if (virBufferUse(&buf) != 0)
@@ -3397,7 +3396,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
     rl_point = strlen(rl_line_buffer);
 
     if (!(matches = vshReadlineCompletion(arg, 0, 0)))
-        goto cleanup;
+        return false;
 
     for (iter = matches; *iter; iter++) {
         if (iter == matches && matches[1])
@@ -3405,9 +3404,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
         printf("%s\n", *iter);
     }
 
-    ret = true;
- cleanup:
-    return ret;
+    return true;
 }
 
 
-- 
2.34.1




[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