]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virBitmapSetBitExpand: Remove return value
authorPeter Krempa <pkrempa@redhat.com>
Mon, 6 Dec 2021 14:55:46 +0000 (15:55 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 10 Dec 2021 15:36:25 +0000 (16:36 +0100)
The function can't fail at this point. Remove the return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/numa_conf.c
src/network/bridge_driver.c
src/util/virbitmap.c
src/util/virbitmap.h
src/util/virhostcpu.c
src/util/virqemu.c
src/util/virtpm.c
tests/testutils.c
tests/virbitmaptest.c

index 3bc1f63a5da484fedeab2c83712440a6661b7bb7..32821bf6a3251f05b87ec916d5b537cb506cd8bd 100644 (file)
@@ -1149,8 +1149,7 @@ virDomainNumaDefValidate(const virDomainNuma *def)
                 return -1;
             }
 
-            if (virBitmapSetBitExpand(levelsSeen, cache->level))
-                return -1;
+            virBitmapSetBitExpand(levelsSeen, cache->level);
         }
     }
 
index 7e5fab630b49781feea9407beb613cae37017b6c..40dccf2c151d6f8c3e854d8df7edb9b66ab83744 100644 (file)
@@ -4966,8 +4966,7 @@ networkNextClassID(virNetworkObj *obj)
     if ((ret = virBitmapNextClearBit(classIdMap, -1)) < 0)
         ret = virBitmapSize(classIdMap);
 
-    if (virBitmapSetBitExpand(classIdMap, ret) < 0)
-        return -1;
+    virBitmapSetBitExpand(classIdMap, ret);
 
     return ret;
 }
index ecc4b96a571166b70b861d1754b79e6c6059927f..a3f674eb19ca19d88535bf26e167dc01845a2afe 100644 (file)
@@ -153,10 +153,8 @@ virBitmapExpand(virBitmap *map,
  *
  * Set bit position @b in @bitmap. Expands the bitmap as necessary so that @b is
  * included in the map.
- *
- * Returns 0 on if bit is successfully set, -1 on error.
  */
-int
+void
 virBitmapSetBitExpand(virBitmap *bitmap,
                       size_t b)
 {
@@ -164,7 +162,6 @@ virBitmapSetBitExpand(virBitmap *bitmap,
         virBitmapExpand(bitmap, b);
 
     bitmap->map[VIR_BITMAP_UNIT_OFFSET(b)] |= VIR_BITMAP_BIT(b);
-    return 0;
 }
 
 
@@ -571,8 +568,7 @@ virBitmapParseUnlimited(const char *str)
             if (neg) {
                 virBitmapClearBitExpand(bitmap, start);
             } else {
-                if (virBitmapSetBitExpand(bitmap, start) < 0)
-                    goto error;
+                virBitmapSetBitExpand(bitmap, start);
             }
         } else if (*cur == '-') {
             if (neg)
@@ -588,10 +584,8 @@ virBitmapParseUnlimited(const char *str)
 
             cur = tmp;
 
-            for (i = start; i <= last; i++) {
-                if (virBitmapSetBitExpand(bitmap, i) < 0)
-                    goto error;
-            }
+            for (i = start; i <= last; i++)
+                virBitmapSetBitExpand(bitmap, i);
 
             virSkipSpaces(&cur);
         }
index 08ada97aa17a16220921463ad8f958deb1ec7f78..e2314904b0c37f0df47b74ca2b61abc2ff1e84d3 100644 (file)
@@ -44,8 +44,8 @@ void virBitmapFree(virBitmap *bitmap);
 int virBitmapSetBit(virBitmap *bitmap, size_t b)
     ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
 
-int virBitmapSetBitExpand(virBitmap *bitmap, size_t b)
-    ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
+void virBitmapSetBitExpand(virBitmap *bitmap, size_t b)
+    ATTRIBUTE_NONNULL(1);
 
 
 /*
index 1920184f61b34674083f2319410085837237018d..83e3a5d0f15a8e53afe4655a23c218c1e724d376 100644 (file)
@@ -336,8 +336,7 @@ virHostCPUParseNode(const char *node,
         if (virHostCPUGetSocket(cpu, &sock) < 0)
             goto cleanup;
 
-        if (virBitmapSetBitExpand(sockets_map, sock) < 0)
-            goto cleanup;
+        virBitmapSetBitExpand(sockets_map, sock);
 
         if (sock > sock_max)
             sock_max = sock;
@@ -396,8 +395,7 @@ virHostCPUParseNode(const char *node,
                 goto cleanup;
         }
 
-        if (virBitmapSetBitExpand(cores_maps[sock], core) < 0)
-            goto cleanup;
+        virBitmapSetBitExpand(cores_maps[sock], core);
 
         if (!(siblings = virHostCPUCountThreadSiblings(cpu)))
             goto cleanup;
index aef6006dd7b46c73bb88b21aebad42d613a2ae8c..8ff61b22b085cc59070572d5acf2d09dbf0667da 100644 (file)
@@ -70,8 +70,7 @@ virQEMUBuildCommandLineJSONArrayBitmap(const char *key,
         if (virJSONValueGetNumberUlong(member, &value) < 0)
             return -1;
 
-        if (virBitmapSetBitExpand(bitmap, value) < 0)
-            return -1;
+        virBitmapSetBitExpand(bitmap, value);
     }
 
     while ((pos = virBitmapNextSetBit(bitmap, pos)) > -1) {
index 63579b8e69a03395302f769d9e0a44a952332109..cf4c7c458f4171b3069f70d32b8e6cbbc9aeead6 100644 (file)
@@ -251,8 +251,7 @@ virTPMExecGetCaps(virCommand *cmd,
         if (typ < 0)
             continue;
 
-        if (virBitmapSetBitExpand(bitmap, typ) < 0)
-            return bitmap;
+        virBitmapSetBitExpand(bitmap, typ);
     }
 
     return bitmap;
index e460c9ecc5227fdd207cf1e9f90bf39faa412353..65f02e023199f66a44d19b3abc59be62155ddc84 100644 (file)
@@ -173,7 +173,7 @@ virTestRun(const char *title,
     }
 
     if (ret != 0 && ret != EXIT_AM_SKIP)
-        ignore_value(virBitmapSetBitExpand(failedTests, testCounter));
+        virBitmapSetBitExpand(failedTests, testCounter);
 
     g_unsetenv("VIR_TEST_MOCK_TESTNAME");
     return ret;
index f16df4d2b2cf9e5b489b2f3cb3424c60e52627fd..89dc702da24278e305621a34dadb78fac7bfab1c 100644 (file)
@@ -558,8 +558,7 @@ test12a(const void *opaque G_GNUC_UNUSED)
     if (checkBitmap(map, "", 0) < 0)
         return -1;
 
-    if (virBitmapSetBitExpand(map, 128) < 0)
-        return -1;
+    virBitmapSetBitExpand(map, 128);
 
     if (checkBitmap(map, "128", 129) < 0)
         return -1;
@@ -692,8 +691,8 @@ test16(const void *opaque G_GNUC_UNUSED)
         return -1;
     }
 
-    ignore_value(virBitmapSetBitExpand(map, 2));
-    ignore_value(virBitmapSetBitExpand(map, 11));
+    virBitmapSetBitExpand(map, 2);
+    virBitmapSetBitExpand(map, 11);
 
     if (!(res_set = virBitmapToString(map)) ||
         STRNEQ_NULLABLE(res_set, "804")) {