Re: [PATCH v2 2/2] virsh: domain: remove unnecessary variable and label in cmdMigrateSetMaxDowntime()

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

 



On 9/24/21 1:30 AM, Kristina Hanicova wrote:
> Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
> ---
>  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




[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