mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 05:17:54 +03: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)
|
cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
|
||||||
{
|
{
|
||||||
const char *from = NULL;
|
const char *from = NULL;
|
||||||
bool ret = false;
|
|
||||||
int result;
|
int result;
|
||||||
g_auto(GStrv) cpus = NULL;
|
g_auto(GStrv) cpus = NULL;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
@ -1219,7 +1218,7 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
|
|||||||
case VIR_CPU_COMPARE_INCOMPATIBLE:
|
case VIR_CPU_COMPARE_INCOMPATIBLE:
|
||||||
vshPrint(ctl, _("CPU described in %s is incompatible with host CPU\n"),
|
vshPrint(ctl, _("CPU described in %s is incompatible with host CPU\n"),
|
||||||
from);
|
from);
|
||||||
goto cleanup;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_CPU_COMPARE_IDENTICAL:
|
case VIR_CPU_COMPARE_IDENTICAL:
|
||||||
@ -1235,13 +1234,10 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
|
|||||||
case VIR_CPU_COMPARE_ERROR:
|
case VIR_CPU_COMPARE_ERROR:
|
||||||
default:
|
default:
|
||||||
vshError(ctl, _("Failed to compare host CPU with %s"), from);
|
vshError(ctl, _("Failed to compare host CPU with %s"), from);
|
||||||
goto cleanup;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = true;
|
return true;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1615,7 +1611,6 @@ cmdHypervisorCPUCompare(vshControl *ctl,
|
|||||||
const char *emulator = NULL;
|
const char *emulator = NULL;
|
||||||
const char *arch = NULL;
|
const char *arch = NULL;
|
||||||
const char *machine = NULL;
|
const char *machine = NULL;
|
||||||
bool ret = false;
|
|
||||||
int result;
|
int result;
|
||||||
g_auto(GStrv) cpus = NULL;
|
g_auto(GStrv) cpus = NULL;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
@ -1646,7 +1641,7 @@ cmdHypervisorCPUCompare(vshControl *ctl,
|
|||||||
_("CPU described in %s is incompatible with the CPU provided "
|
_("CPU described in %s is incompatible with the CPU provided "
|
||||||
"by hypervisor on the host\n"),
|
"by hypervisor on the host\n"),
|
||||||
from);
|
from);
|
||||||
goto cleanup;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_CPU_COMPARE_IDENTICAL:
|
case VIR_CPU_COMPARE_IDENTICAL:
|
||||||
@ -1666,13 +1661,10 @@ cmdHypervisorCPUCompare(vshControl *ctl,
|
|||||||
case VIR_CPU_COMPARE_ERROR:
|
case VIR_CPU_COMPARE_ERROR:
|
||||||
default:
|
default:
|
||||||
vshError(ctl, _("Failed to compare hypervisor CPU with %s"), from);
|
vshError(ctl, _("Failed to compare hypervisor CPU with %s"), from);
|
||||||
goto cleanup;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = true;
|
return true;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
11
tools/vsh.c
11
tools/vsh.c
@ -3360,7 +3360,6 @@ const vshCmdInfo info_complete[] = {
|
|||||||
bool
|
bool
|
||||||
cmdComplete(vshControl *ctl, const vshCmd *cmd)
|
cmdComplete(vshControl *ctl, const vshCmd *cmd)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
|
||||||
const vshClientHooks *hooks = ctl->hooks;
|
const vshClientHooks *hooks = ctl->hooks;
|
||||||
int stdin_fileno = STDIN_FILENO;
|
int stdin_fileno = STDIN_FILENO;
|
||||||
const char *arg = "";
|
const char *arg = "";
|
||||||
@ -3370,7 +3369,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
|
|||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (vshCommandOptStringQuiet(ctl, cmd, "string", &arg) <= 0)
|
if (vshCommandOptStringQuiet(ctl, cmd, "string", &arg) <= 0)
|
||||||
goto cleanup;
|
return false;
|
||||||
|
|
||||||
/* This command is flagged VSH_CMD_FLAG_NOCONNECT because we
|
/* This command is flagged VSH_CMD_FLAG_NOCONNECT because we
|
||||||
* need to prevent auth hooks reading any input. Therefore, 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);
|
VIR_FORCE_CLOSE(stdin_fileno);
|
||||||
|
|
||||||
if (!(hooks && hooks->connHandler && hooks->connHandler(ctl)))
|
if (!(hooks && hooks->connHandler && hooks->connHandler(ctl)))
|
||||||
goto cleanup;
|
return false;
|
||||||
|
|
||||||
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
|
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
|
||||||
if (virBufferUse(&buf) != 0)
|
if (virBufferUse(&buf) != 0)
|
||||||
@ -3397,7 +3396,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
|
|||||||
rl_point = strlen(rl_line_buffer);
|
rl_point = strlen(rl_line_buffer);
|
||||||
|
|
||||||
if (!(matches = vshReadlineCompletion(arg, 0, 0)))
|
if (!(matches = vshReadlineCompletion(arg, 0, 0)))
|
||||||
goto cleanup;
|
return false;
|
||||||
|
|
||||||
for (iter = matches; *iter; iter++) {
|
for (iter = matches; *iter; iter++) {
|
||||||
if (iter == matches && matches[1])
|
if (iter == matches && matches[1])
|
||||||
@ -3405,9 +3404,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
|
|||||||
printf("%s\n", *iter);
|
printf("%s\n", *iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = true;
|
return true;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user