Re: [PATCH 4/7] conf: use insertAt instead of j

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

 



On 04/11/2016 09:38 AM, Ján Tomko wrote:
> We call VIR_INSERT_ELEMENT_INPLACE either with 0 (for primary video)
> or def->nvideos (for the rest).
> 
> Use a variable with more semantic name, since j is usually used
> for iterating.
> ---
>  src/conf/domain_conf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index fe87168..e9b1e21 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -16419,8 +16419,8 @@ virDomainDefParseXML(xmlDocPtr xml,
>      if (n && VIR_ALLOC_N(def->videos, n) < 0)
>          goto error;
>      for (i = 0; i < n; i++) {
> -        j = def->nvideos;
>          virDomainVideoDefPtr video;
> +        ssize_t insertAt = -1;
>  
>          if (!(video = virDomainVideoDefParseXML(nodes[i], def, flags)))
>              goto error;
> @@ -16433,11 +16433,11 @@ virDomainDefParseXML(xmlDocPtr xml,
>                  goto error;
>              }
>  
> -            j = 0;
> +            insertAt = 0;
>              primaryVideo = true;
>          }
>          if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
> -                                       j,
> +                                       insertAt,
>                                         def->nvideos,
>                                         video) < 0) {
>              virDomainVideoDefFree(video);
> 

I had to check that -1 means 'insert at the end' :)

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]