]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virBitmapExpand: Remove return value
authorPeter Krempa <pkrempa@redhat.com>
Mon, 6 Dec 2021 14:53:27 +0000 (15:53 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 10 Dec 2021 15:36:24 +0000 (16:36 +0100)
There's nothing that can fail in the function. Remove the return value
and adjust callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virbitmap.c

index 5f14f1e5e0b9a8313b2ad2090ae63c7a8a74a954..2b885803fde43c9cf4b60840058e43b7e104eb86 100644 (file)
@@ -128,10 +128,8 @@ virBitmapSetBit(virBitmap *bitmap,
  *
  * Resizes the bitmap so that bit @b will fit into it. This shall be called only
  * if @b would not fit into the map.
- *
- * Returns 0 on success, -1 on error.
  */
-static int
+static void
 virBitmapExpand(virBitmap *map,
                 size_t b)
 {
@@ -145,8 +143,6 @@ virBitmapExpand(virBitmap *map,
 
     map->nbits = b + 1;
     map->map_len = new_len;
-
-    return 0;
 }
 
 
@@ -164,8 +160,8 @@ int
 virBitmapSetBitExpand(virBitmap *bitmap,
                       size_t b)
 {
-    if (bitmap->nbits <= b && virBitmapExpand(bitmap, b) < 0)
-        return -1;
+    if (bitmap->nbits <= b)
+        virBitmapExpand(bitmap, b);
 
     bitmap->map[VIR_BITMAP_UNIT_OFFSET(b)] |= VIR_BITMAP_BIT(b);
     return 0;
@@ -208,8 +204,7 @@ virBitmapClearBitExpand(virBitmap *bitmap,
                         size_t b)
 {
     if (bitmap->nbits <= b) {
-        if (virBitmapExpand(bitmap, b) < 0)
-            return -1;
+        virBitmapExpand(bitmap, b);
     } else {
         bitmap->map[VIR_BITMAP_UNIT_OFFSET(b)] &= ~VIR_BITMAP_BIT(b);
     }
@@ -1178,10 +1173,8 @@ virBitmapUnion(virBitmap *a,
 {
     size_t i;
 
-    if (a->nbits < b->nbits &&
-        virBitmapExpand(a, b->nbits - 1) < 0) {
-        return -1;
-    }
+    if (a->nbits < b->nbits)
+        virBitmapExpand(a, b->nbits - 1);
 
     for (i = 0; i < b->map_len; i++)
         a->map[i] |= b->map[i];