Re: [PATCH 6/7] conf: reduce indentation in virDomainDefAddImplicitVideo

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

 



On 04/11/2016 09:38 AM, Ján Tomko wrote:
> Return early if there is nothing to do.
> ---
>  src/conf/domain_conf.c | 31 ++++++++++++++++---------------
>  1 file changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 1788c91..7d48517 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -18649,22 +18649,23 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def)
>  
>      /* For backwards compatibility, if no <video> tag is set but there
>       * is a <graphics> tag, then we add a single video tag */
> -    if (def->ngraphics && !def->nvideos) {
> -        if (VIR_ALLOC(video) < 0)
> -            goto cleanup;
> -        video->type = virDomainVideoDefaultType(def);
> -        if (video->type < 0) {
> -            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                           _("cannot determine default video type"));
> -            goto cleanup;
> -        }
> -        video->vram = virDomainVideoDefaultRAM(def, video->type);
> -        video->heads = 1;
> -        if (VIR_ALLOC_N(def->videos, 1) < 0)
> -            goto cleanup;
> -        def->videos[def->nvideos++] = video;
> -        video = NULL;
> +    if (def->ngraphics == 0 || def->nvideos > 0)
> +        return 0;
> +
> +    if (VIR_ALLOC(video) < 0)
> +        goto cleanup;
> +    video->type = virDomainVideoDefaultType(def);
> +    if (video->type < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("cannot determine default video type"));
> +        goto cleanup;
>      }
> +    video->vram = virDomainVideoDefaultRAM(def, video->type);
> +    video->heads = 1;
> +    if (VIR_ALLOC_N(def->videos, 1) < 0)
> +        goto cleanup;
> +    def->videos[def->nvideos++] = video;
> +    video = NULL;
>  
>      ret = 0;
>   cleanup:
> 

ACK

- Cole

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]