mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-02 04:21:59 +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:
@ -108,7 +108,7 @@ virReallocN(void *ptrptr,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tmp = realloc(*(void**)ptrptr, size * count);
|
tmp = realloc(*(void**)ptrptr, size * count);
|
||||||
if (!tmp && (size * count)) {
|
if (!tmp && ((size * count) != 0)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*(void**)ptrptr = tmp;
|
*(void**)ptrptr = tmp;
|
||||||
|
Reference in New Issue
Block a user