diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2017-09-26 11:14:03 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2017-09-26 11:14:03 +0100 |
commit | ac8faf417ed4fbea0e3a579ffd365bbcc09d913f (patch) | |
tree | b95e91ca65660851799d0f3f6e070c489f4af2f1 /libvirt-utils.c | |
parent | 75ec2acb6163b4f71921e6efbaca088fa8ed16a9 (diff) | |
download | libvirt-python-ac8faf417ed4fbea0e3a579ffd365bbcc09d913f.tar.gz |
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>
Diffstat (limited to 'libvirt-utils.c')
-rw-r--r-- | libvirt-utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libvirt-utils.c b/libvirt-utils.c index b8ac5e9..f7b4478 100644 --- a/libvirt-utils.c +++ b/libvirt-utils.c @@ -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; |