mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Use VIR_DIV_UP macro where possible
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
789bdd7dea
commit
d772a70faa
@ -279,7 +279,7 @@ int virNetClientStreamQueuePacket(virNetClientStreamPtr st,
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
pieces = (length + size - 1) / size;
|
pieces = VIR_DIV_UP(length, size);
|
||||||
for (piece = 0; piece < pieces; piece++) {
|
for (piece = 0; piece < pieces; piece++) {
|
||||||
if (size > length - offset)
|
if (size > length - offset)
|
||||||
size = length - offset;
|
size = length - offset;
|
||||||
|
@ -71,7 +71,7 @@ virBitmapNewQuiet(size_t size)
|
|||||||
if (SIZE_MAX - VIR_BITMAP_BITS_PER_UNIT < size || size == 0)
|
if (SIZE_MAX - VIR_BITMAP_BITS_PER_UNIT < size || size == 0)
|
||||||
return NULL;
|
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)
|
if (VIR_ALLOC_QUIET(bitmap) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user