mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
virsh: Remove needless labels
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7b9cebac22
commit
364cf32e57
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
11
tools/vsh.c
11
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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user