mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-06 09:55:46 +00:00
virnumamock: Use automatic memory freeing for virBitmap
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
33eb88cdc9
commit
f89c929b1e
@ -63,29 +63,23 @@ virNumaIsAvailable(void)
|
|||||||
int
|
int
|
||||||
virNumaGetMaxNode(void)
|
virNumaGetMaxNode(void)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
g_autoptr(virBitmap) map = NULL;
|
||||||
virBitmap *map = NULL;
|
|
||||||
|
|
||||||
if (virFileReadValueBitmap(&map, "%s/node/online", SYSFS_SYSTEM_PATH) < 0)
|
if (virFileReadValueBitmap(&map, "%s/node/online", SYSFS_SYSTEM_PATH) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virBitmapLastSetBit(map);
|
return virBitmapLastSetBit(map);
|
||||||
virBitmapFree(map);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
virNumaNodeIsAvailable(int node)
|
virNumaNodeIsAvailable(int node)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
g_autoptr(virBitmap) map = NULL;
|
||||||
virBitmap *map = NULL;
|
|
||||||
|
|
||||||
if (virFileReadValueBitmap(&map, "%s/node/online", SYSFS_SYSTEM_PATH) < 0)
|
if (virFileReadValueBitmap(&map, "%s/node/online", SYSFS_SYSTEM_PATH) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ret = virBitmapIsBitSet(map, node);
|
return virBitmapIsBitSet(map, node);
|
||||||
virBitmapFree(map);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user