mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
virBitmapToString: Remove unused 'prefix' and 'trim' arguments
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>
This commit is contained in:
parent
c00ab99f16
commit
8efad320fa
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user