]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Use explicit boolean comparison in OOM check
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 22 Feb 2017 16:42:45 +0000 (16:42 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 23 Feb 2017 10:11:16 +0000 (10:11 +0000)
commit09db97d3cbf334ea28969f08bac8a2fe4aafda16
tree576552bdc47590e1442a15401a0e3fdbf6e23fa4
parent0518aae304801986a31454ba226eb5a614c5b6e6
Use explicit boolean comparison in OOM check

GCC 7 gets upset by

   if (!tmp && (size * count))

warning

  util/viralloc.c: In function 'virReallocN':
  util/viralloc.c:246:23: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
     if (!tmp && (size * count)) {
                 ~~~~~~^~~~~~~~

Keep it happy by adding != 0 to the right hand expression
so it realizes we really are wanting to treat the result
of the arithmetic expression as a boolean

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/util/viralloc.c