1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 16:25:10 +03:00

Avoid implicit treatment of an arithmetic result as a boolean

Latest GCC versions are unhappy with us treating an integer
arithmetic result as a boolean:

libvirt-utils.c: In function ‘virReallocN’:
libvirt-utils.c:111:23: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
     if (!tmp && (size * count)) {
                 ~~~~~~^~~~~~~~

Add an explicit comparison '!= 0' to keep it happy, since its
suggestion to use '&&' is nonsense.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2017-09-26 11:14:03 +01:00
parent 75ec2acb61
commit ac8faf417e

View File

@ -108,7 +108,7 @@ virReallocN(void *ptrptr,
return -1;
}
tmp = realloc(*(void**)ptrptr, size * count);
if (!tmp && (size * count)) {
if (!tmp && ((size * count) != 0)) {
return -1;
}
*(void**)ptrptr = tmp;