[PATCH] Use VIR_DIV_UP macro where possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
Will push as trivial in a second.

 src/rpc/virnetclientstream.c | 2 +-
 src/util/virbitmap.c         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index 1cc9002b0ad7..64e9cd221be2 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 4d270a910c19..57135a09f71e 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;
--
2.5.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]