[PATCH v2 2/2] virsh: domain: remove unnecessary variable and label in cmdMigrateSetMaxDowntime()
Michal Prívozník
mprivozn at redhat.com
Fri Sep 24 09:03:08 UTC 2021
On 9/24/21 1:30 AM, Kristina Hanicova wrote:
> Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
> ---
> tools/virsh-domain.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 2730acfba5..cfa0016296 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -11006,25 +11006,19 @@ cmdMigrateSetMaxDowntime(vshControl *ctl, const vshCmd *cmd)
> {
> g_autoptr(virshDomain) dom = NULL;
> unsigned long long downtime = 0;
> - bool ret = false;
>
> if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
> return false;
>
> if (vshCommandOptULongLong(ctl, cmd, "downtime", &downtime) < 0)
> - goto done;
> + return false;
> +
> if (downtime < 1) {
> vshError(ctl, "%s", _("migrate: Invalid downtime"));
> - goto done;
> + return false;
> }
>
> - if (virDomainMigrateSetMaxDowntime(dom, downtime, 0) < 0)
> - goto done;
> -
> - ret = true;
> -
> - done:
> - return ret;
> + return virDomainMigrateSetMaxDowntime(dom, downtime, 0) == 0;
> }
>
>
>
Honestly, I'm not big fan of return func() == 0 type of statements. But
I think I can live with this.
Michal
More information about the libvir-list
mailing list