We no longer report any errors so all callers can be replaced by
virBitmapNew. Additionally virBitmapNEw can't return NULL now so error
handling is not necessary.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/libvirt_private.syms | 1 -
src/util/virbitmap.c | 25 ++-----------------------
src/util/virbitmap.h | 1 -
src/util/virjson.c | 3 +--
tools/virt-host-validate-common.c | 4 +---
5 files changed, 4 insertions(+), 30 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4e66385bab..185f120f6b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1684,7 +1684,6 @@ virBitmapNew;
virBitmapNewCopy;
virBitmapNewData;
virBitmapNewEmpty;
-virBitmapNewQuiet;
virBitmapNewString;
virBitmapNextClearBit;
virBitmapNextSetBit;
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index a49019f884..5d224a8def 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -50,7 +50,7 @@ struct _virBitmap {
/**
- * virBitmapNewQuiet:
+ * virBitmapNew:
* @size: number of bits
*
* Allocate a bitmap capable of containing @size bits.
@@ -58,7 +58,7 @@ struct _virBitmap {
* Returns a pointer to the allocated bitmap.
*/
virBitmapPtr
-virBitmapNewQuiet(size_t size)
+virBitmapNew(size_t size)
{
virBitmapPtr bitmap;
size_t sz;
@@ -84,27 +84,6 @@ virBitmapNewQuiet(size_t size)
}
-/**
- * virBitmapNew:
- * @size: number of bits
- *
- * Allocate a bitmap capable of containing @size bits.
- *
- * Returns a pointer to the allocated bitmap or NULL if either memory cannot be
- * allocated or size is 0. Reports libvirt errors.
- */
-virBitmapPtr
-virBitmapNew(size_t size)
-{
- virBitmapPtr ret;
-
- if (!(ret = virBitmapNewQuiet(size)))
- virReportOOMError();
-
- return ret;
-}
-
-
/**
* virBitmapNewEmpty:
*
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 615ec6e4af..57264fef0e 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -32,7 +32,6 @@ typedef virBitmap *virBitmapPtr;
/*
* Allocate a bitmap capable of containing @size bits.
*/
-virBitmapPtr virBitmapNewQuiet(size_t size) G_GNUC_WARN_UNUSED_RESULT;
virBitmapPtr virBitmapNew(size_t size) G_GNUC_WARN_UNUSED_RESULT;
virBitmapPtr virBitmapNewEmpty(void) G_GNUC_WARN_UNUSED_RESULT;
diff --git a/src/util/virjson.c b/src/util/virjson.c
index ba43d6b667..a4fc9e990e 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1257,8 +1257,7 @@ virJSONValueGetArrayAsBitmap(const virJSONValue *val,
maxelem = elems[i];
}
- if (!(*bitmap = virBitmapNewQuiet(maxelem + 1)))
- return -1;
+ *bitmap = virBitmapNew(maxelem + 1);
/* second pass sets the correct bits in the map */
for (i = 0; i < val->data.array.nvalues; i++)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index e0e22a133a..c3784bb91d 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -196,8 +196,7 @@ virBitmapPtr virHostValidateGetCPUFlags(void)
if (!(fp = fopen("/proc/cpuinfo", "r")))
return NULL;
- if (!(flags = virBitmapNewQuiet(VIR_HOST_VALIDATE_CPU_FLAG_LAST)))
- goto cleanup;
+ flags = virBitmapNew(VIR_HOST_VALIDATE_CPU_FLAG_LAST);
do {
char line[1024];
@@ -245,7 +244,6 @@ virBitmapPtr virHostValidateGetCPUFlags(void)
virStringListFreeCount(tokens, ntokens);
} while (1);
- cleanup:
VIR_FORCE_FCLOSE(fp);
return flags;
--
2.26.2