From: Martin Kletzander Date: Mon, 24 Aug 2015 13:54:26 +0000 (+0200) Subject: Use VIR_DIV_UP macro where possible X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d772a70faa0e270a7faba2afefcfb5a03e930b5e;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git Use VIR_DIV_UP macro where possible Signed-off-by: Martin Kletzander --- diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c index 1cc9002b0..64e9cd221 100644 --- a/src/rpc/virnetclientstream.c +++ b/src/rpc/virnetclientstream.c @@ -279,7 +279,7 @@ int virNetClientStreamQueuePacket(virNetClientStreamPtr st, goto end; } - pieces = (length + size - 1) / size; + pieces = VIR_DIV_UP(length, size); for (piece = 0; piece < pieces; piece++) { if (size > length - offset) size = length - offset; diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 4d270a910..57135a09f 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -71,7 +71,7 @@ virBitmapNewQuiet(size_t size) if (SIZE_MAX - VIR_BITMAP_BITS_PER_UNIT < size || size == 0) return NULL; - sz = (size + VIR_BITMAP_BITS_PER_UNIT - 1) / VIR_BITMAP_BITS_PER_UNIT; + sz = VIR_DIV_UP(size, VIR_BITMAP_BITS_PER_UNIT); if (VIR_ALLOC_QUIET(bitmap) < 0) return NULL;