It can be replaced by virBitmapNew(0).
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/numa_conf.c | 2 +-
src/libvirt_private.syms | 1 -
src/util/virbitmap.c | 16 +---------------
src/util/virbitmap.h | 1 -
src/util/virhostcpu.c | 4 ++--
src/util/virnuma.c | 2 +-
src/util/virtpm.c | 2 +-
tests/virbitmaptest.c | 8 ++++----
8 files changed, 10 insertions(+), 26 deletions(-)
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index cc6c77f105..b5ddf2c134 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -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];
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 185f120f6b..01ae3cad93 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1683,7 +1683,6 @@ virBitmapLastSetBit;
virBitmapNew;
virBitmapNewCopy;
virBitmapNewData;
-virBitmapNewEmpty;
virBitmapNewString;
virBitmapNextClearBit;
virBitmapNextSetBit;
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 5d224a8def..1bff5d4ae6 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -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;
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 88af3bbadc..cd5caa6f61 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -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
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index f7e92cd924..c00a393def 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -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++) {
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index 39f0f30917..5a1218cdf2 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -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++) {
diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index 1a3b5a05aa..0e11674a3c 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -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) {
diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c
index c14a6c7e26..255492c9e8 100644
--- a/tests/virbitmaptest.c
+++ b/tests/virbitmaptest.c
@@ -178,7 +178,7 @@ test4(const void *data G_GNUC_UNUSED)
/* 0. empty set */
- bitmap = virBitmapNewEmpty();
+ bitmap = virBitmapNew(0);
if (virBitmapNextSetBit(bitmap, -1) != -1)
return -1;
@@ -571,7 +571,7 @@ test11(const void *opaque)
static int
test12(const void *opaque G_GNUC_UNUSED)
{
- g_autoptr(virBitmap) map = virBitmapNewEmpty();
+ g_autoptr(virBitmap) map = virBitmapNew(0);
TEST_MAP(0, "");
@@ -684,11 +684,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;
--
2.26.2