]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virBitmapToString: Remove unused 'prefix' and 'trim' arguments
authorPeter Krempa <pkrempa@redhat.com>
Thu, 1 Oct 2020 13:22:24 +0000 (15:22 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 5 Oct 2020 10:26:22 +0000 (12:26 +0200)
There's only one combination used so we can remove the rest.

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

index 639103e518fd62ec8ef112fcbad82d563e57ccca..ad5213f216375d43d3189be73a321b7501adbbac 100644 (file)
@@ -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;
index 7f1a109c012ec4e33f5d579e1a7790acdc97eddc..615ec6e4af4c3da8a3bcac0cd78509f97ccb03f6 100644 (file)
@@ -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);
index 6de700a645042e2dd17f6c5611a02696eb9d13f0..2d945ff93433bdbe4acb16fb0213f0e5d48b26f1 100644 (file)
@@ -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;
 
index 1c7dc1d6104acdc6423dab867f553d0638de71a7..e1a49bfe356624b4d4671fae6ca9cee5a2f1a45e 100644 (file)
@@ -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;