There's only one combination used so we can remove the rest.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/virbitmap.c | 15 +--------------
src/util/virbitmap.h | 2 +-
src/util/virresctrl.c | 2 +-
tests/virbitmaptest.c | 2 +-
4 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 639103e518..ad5213f216 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -327,17 +327,13 @@ virBitmapGetBit(virBitmapPtr bitmap,
/**
* virBitmapToString:
* @bitmap: Pointer to bitmap
- * @prefix: Whether to prepend "0x"
- * @trim: Whether to output only the minimum required characters
*
* Convert @bitmap to printable string.
*
* Returns pointer to the string or NULL on error.
*/
char *
-virBitmapToString(virBitmapPtr bitmap,
- bool prefix,
- bool trim)
+virBitmapToString(virBitmapPtr bitmap)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t sz;
@@ -345,9 +341,6 @@ virBitmapToString(virBitmapPtr bitmap,
size_t diff;
char *ret = NULL;
- if (prefix)
- virBufferAddLit(&buf, "0x");
-
sz = bitmap->map_len;
while (sz--) {
@@ -360,15 +353,9 @@ virBitmapToString(virBitmapPtr bitmap,
if (!ret)
return NULL;
- if (!trim)
- return ret;
-
if (bitmap->nbits != bitmap->map_len * VIR_BITMAP_BITS_PER_UNIT) {
char *tmp = ret;
- if (prefix)
- tmp += 2;
-
len = strlen(tmp);
sz = VIR_DIV_UP(bitmap->nbits, 4);
diff = len - sz;
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 7f1a109c01..615ec6e4af 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -81,7 +81,7 @@ virBitmapPtr
virBitmapNewString(const char *string)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
-char *virBitmapToString(virBitmapPtr bitmap, bool prefix, bool trim)
+char *virBitmapToString(virBitmapPtr bitmap)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
char *virBitmapFormat(virBitmapPtr bitmap);
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 6de700a645..2d945ff934 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -1592,7 +1592,7 @@ virResctrlAllocFormatCache(virResctrlAllocPtr alloc,
if (!mask)
continue;
- mask_str = virBitmapToString(mask, false, true);
+ mask_str = virBitmapToString(mask);
if (!mask_str)
return -1;
diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c
index 1c7dc1d610..e1a49bfe35 100644
--- a/tests/virbitmaptest.c
+++ b/tests/virbitmaptest.c
@@ -681,7 +681,7 @@ test13(const void *opaque G_GNUC_UNUSED)
if (!map)
goto cleanup;
- str = virBitmapToString(map, false, true);
+ str = virBitmapToString(map);
if (!str)
goto cleanup;
--
2.26.2