[libvirt] [PATCH 2/3] conf: Clean up virDomainNumaDefCPUFormatXML

John Ferlan posted 3 patches 7 years, 5 months ago
[libvirt] [PATCH 2/3] conf: Clean up virDomainNumaDefCPUFormatXML
Posted by John Ferlan 7 years, 5 months ago
Don't use a unary comparison for an int value - compare against zero
directly instead.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/conf/numa_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 3aae705a5d..eadf8f2282 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -992,7 +992,7 @@ virDomainNumaDefCPUFormatXML(virBufferPtr buf,
                               virDomainMemoryAccessTypeToString(memAccess));
 
         ndistances = def->mem_nodes[i].ndistances;
-        if (!ndistances) {
+        if (ndistances == 0) {
             virBufferAddLit(buf, "/>\n");
         } else {
             size_t j;
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/3] conf: Clean up virDomainNumaDefCPUFormatXML
Posted by Michal Privoznik 7 years, 5 months ago
On 11/24/2017 06:18 PM, John Ferlan wrote:
> Don't use a unary comparison for an int value - compare against zero
> directly instead.
> 
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/conf/numa_conf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
> index 3aae705a5d..eadf8f2282 100644
> --- a/src/conf/numa_conf.c
> +++ b/src/conf/numa_conf.c
> @@ -992,7 +992,7 @@ virDomainNumaDefCPUFormatXML(virBufferPtr buf,
>                                virDomainMemoryAccessTypeToString(memAccess));
>  
>          ndistances = def->mem_nodes[i].ndistances;
> -        if (!ndistances) {
> +        if (ndistances == 0) {
>              virBufferAddLit(buf, "/>\n");
>          } else {
>              size_t j;
> 

You know that I don't care that much :-) But at the same time, if !int
and int == 0 are equal to me, but you prefer one, we can use the one you
prefer (since those two options are equal to me).

Michal

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