mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
util: Make prefix optional in virBitampString
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
87a8a30d61
commit
d127aced0a
@ -1510,7 +1510,7 @@ int virQEMUCapsParseHelpStr(const char *qemu,
|
||||
qemuCaps, check_yajl) < 0)
|
||||
goto cleanup;
|
||||
|
||||
strflags = virBitmapString(qemuCaps->flags);
|
||||
strflags = virBitmapString(qemuCaps->flags, true);
|
||||
VIR_DEBUG("Version %u.%u.%u, cooked version %u, flags %s",
|
||||
major, minor, micro, *version, NULLSTR(strflags));
|
||||
VIR_FREE(strflags);
|
||||
@ -2377,7 +2377,7 @@ virQEMUCapsClear(virQEMUCapsPtr qemuCaps,
|
||||
|
||||
char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
return virBitmapString(qemuCaps->flags);
|
||||
return virBitmapString(qemuCaps->flags, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -312,17 +312,21 @@ int virBitmapGetBit(virBitmapPtr bitmap, size_t b, bool *result)
|
||||
/**
|
||||
* virBitmapString:
|
||||
* @bitmap: Pointer to bitmap
|
||||
* @prefix: Whether to prepend "0x"
|
||||
*
|
||||
* Convert @bitmap to printable string.
|
||||
*
|
||||
* Returns pointer to the string or NULL on error.
|
||||
*/
|
||||
char *virBitmapString(virBitmapPtr bitmap)
|
||||
char *
|
||||
virBitmapString(virBitmapPtr bitmap,
|
||||
bool prefix)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
size_t sz;
|
||||
|
||||
virBufferAddLit(&buf, "0x");
|
||||
if (prefix)
|
||||
virBufferAddLit(&buf, "0x");
|
||||
|
||||
sz = bitmap->map_len;
|
||||
|
||||
|
@ -80,7 +80,7 @@ bool virBitmapIsBitSet(virBitmapPtr bitmap, size_t b)
|
||||
int virBitmapGetBit(virBitmapPtr bitmap, size_t b, bool *result)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
char *virBitmapString(virBitmapPtr bitmap)
|
||||
char *virBitmapString(virBitmapPtr bitmap, bool prefix)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
char *virBitmapFormat(virBitmapPtr bitmap);
|
||||
|
Loading…
Reference in New Issue
Block a user