The function can't fail at this point. Remove the return value.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/numa_conf.c | 3 +--
src/network/bridge_driver.c | 3 +--
src/util/virbitmap.c | 14 ++++----------
src/util/virbitmap.h | 4 ++--
src/util/virhostcpu.c | 6 ++----
src/util/virqemu.c | 3 +--
src/util/virtpm.c | 3 +--
tests/testutils.c | 2 +-
tests/virbitmaptest.c | 7 +++----
9 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 3bc1f63a5d..32821bf6a3 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -1149,8 +1149,7 @@ virDomainNumaDefValidate(const virDomainNuma *def)
return -1;
}
- if (virBitmapSetBitExpand(levelsSeen, cache->level))
- return -1;
+ virBitmapSetBitExpand(levelsSeen, cache->level);
}
}
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 7e5fab630b..40dccf2c15 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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;
}
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index ecc4b96a57..a3f674eb19 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -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);
}
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 08ada97aa1..e2314904b0 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -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);
/*
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 1920184f61..83e3a5d0f1 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -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;
diff --git a/src/util/virqemu.c b/src/util/virqemu.c
index aef6006dd7..8ff61b22b0 100644
--- a/src/util/virqemu.c
+++ b/src/util/virqemu.c
@@ -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) {
diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index 63579b8e69..cf4c7c458f 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -251,8 +251,7 @@ virTPMExecGetCaps(virCommand *cmd,
if (typ < 0)
continue;
- if (virBitmapSetBitExpand(bitmap, typ) < 0)
- return bitmap;
+ virBitmapSetBitExpand(bitmap, typ);
}
return bitmap;
diff --git a/tests/testutils.c b/tests/testutils.c
index e460c9ecc5..65f02e0231 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -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;
diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c
index f16df4d2b2..89dc702da2 100644
--- a/tests/virbitmaptest.c
+++ b/tests/virbitmaptest.c
@@ -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")) {
--
2.31.1