util: bitamp: Remove virBitmapNewEmpty

It can be replaced by virBitmapNew(0).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-10-01 17:02:16 +02:00
parent f054317a0b
commit bab5a79d6a
8 changed files with 10 additions and 26 deletions

View File

@ -1374,7 +1374,7 @@ virDomainNumaDefValidate(const virDomainNuma *def)
for (i = 0; i < def->nmem_nodes; i++) {
const virDomainNumaNode *node = &def->mem_nodes[i];
g_autoptr(virBitmap) levelsSeen = virBitmapNewEmpty();
g_autoptr(virBitmap) levelsSeen = virBitmapNew(0);
for (j = 0; j < node->ncaches; j++) {
const virDomainNumaCache *cache = &node->caches[j];

View File

@ -1683,7 +1683,6 @@ virBitmapLastSetBit;
virBitmapNew;
virBitmapNewCopy;
virBitmapNewData;
virBitmapNewEmpty;
virBitmapNewString;
virBitmapNextClearBit;
virBitmapNextSetBit;

View File

@ -84,20 +84,6 @@ virBitmapNew(size_t size)
}
/**
* virBitmapNewEmpty:
*
* Allocate an empty bitmap. It can be used with self-expanding APIs.
*
* Returns a pointer to the allocated bitmap.
*/
virBitmapPtr
virBitmapNewEmpty(void)
{
return g_new0(virBitmap, 1);
}
/**
* virBitmapFree:
* @bitmap: previously allocated bitmap
@ -576,7 +562,7 @@ virBitmapParse(const char *str,
virBitmapPtr
virBitmapParseUnlimited(const char *str)
{
virBitmapPtr bitmap = virBitmapNewEmpty();
virBitmapPtr bitmap = virBitmapNew(0);
bool neg = false;
const char *cur = str;
char *tmp;

View File

@ -33,7 +33,6 @@ typedef virBitmap *virBitmapPtr;
* Allocate a bitmap capable of containing @size bits.
*/
virBitmapPtr virBitmapNew(size_t size);
virBitmapPtr virBitmapNewEmpty(void) G_GNUC_WARN_UNUSED_RESULT;
/*
* Free previously allocated bitmap

View File

@ -336,7 +336,7 @@ virHostCPUParseNode(const char *node,
goto cleanup;
/* enumerate sockets in the node */
sockets_map = virBitmapNewEmpty();
sockets_map = virBitmapNew(0);
while ((direrr = virDirRead(cpudir, &cpudirent, node)) > 0) {
if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1)
@ -372,7 +372,7 @@ virHostCPUParseNode(const char *node,
goto cleanup;
for (i = 0; i < sock_max; i++)
cores_maps[i] = virBitmapNewEmpty();
cores_maps[i] = virBitmapNew(0);
/* Iterate over all CPUs in the node, in ascending order */
for (cpu = 0; cpu < npresent_cpus; cpu++) {

View File

@ -311,7 +311,7 @@ virNumaNodesetToCPUset(virBitmapPtr nodeset,
if (!nodeset)
return 0;
allNodesCPUs = virBitmapNewEmpty();
allNodesCPUs = virBitmapNew(0);
nodesetSize = virBitmapSize(nodeset);
for (i = 0; i < nodesetSize; i++) {

View File

@ -183,7 +183,7 @@ virTPMExecGetCaps(virCommandPtr cmd,
if (virCommandRun(cmd, &exitstatus) < 0)
return NULL;
bitmap = virBitmapNewEmpty();
bitmap = virBitmapNew(0);
/* older version does not support --print-capabilties -- that's fine */
if (exitstatus != 0) {

View File

@ -189,7 +189,7 @@ test4a(const void *data G_GNUC_UNUSED)
/* 0. empty set */
bitmap = virBitmapNewEmpty();
bitmap = virBitmapNew(0);
if (virBitmapNextSetBit(bitmap, -1) != -1)
return -1;
@ -561,7 +561,7 @@ test11(const void *opaque)
static int
test12a(const void *opaque G_GNUC_UNUSED)
{
g_autoptr(virBitmap) map = virBitmapNewEmpty();
g_autoptr(virBitmap) map = virBitmapNew(0);
if (checkBitmap(map, "", 0) < 0)
return -1;
@ -687,11 +687,11 @@ test15(const void *opaque)
}
/* virBitmapNewEmpty + virBitmapToString */
/* virBitmapNew(0) + virBitmapToString */
static int
test16(const void *opaque G_GNUC_UNUSED)
{
g_autoptr(virBitmap) map = virBitmapNewEmpty();
g_autoptr(virBitmap) map = virBitmapNew(0);
g_autofree char *res_empty = NULL;
g_autofree char *res_set = NULL;