]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: bitmap: Remove virBitmapNewQuiet
authorPeter Krempa <pkrempa@redhat.com>
Thu, 1 Oct 2020 14:56:48 +0000 (16:56 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 5 Oct 2020 10:57:46 +0000 (12:57 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libvirt_private.syms
src/util/virbitmap.c
src/util/virbitmap.h
src/util/virjson.c
tools/virt-host-validate-common.c

index 4e66385babab8d22989526493df919bde674da23..185f120f6b1a15354bce45b54d5ab3c66505d449 100644 (file)
@@ -1684,7 +1684,6 @@ virBitmapNew;
 virBitmapNewCopy;
 virBitmapNewData;
 virBitmapNewEmpty;
-virBitmapNewQuiet;
 virBitmapNewString;
 virBitmapNextClearBit;
 virBitmapNextSetBit;
index 68f44062f2f79fae3866f4d8cc1e859ac2f2375b..3545160957f10a06504bd77fd84f6abe1200c9ed 100644 (file)
@@ -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:
  *
index 3b4c4acceb84e94d5fb7161bf4c8164387ffd521..88af3bbadcf688837ae3655098832eb2accca3d4 100644 (file)
@@ -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);
 virBitmapPtr virBitmapNewEmpty(void) G_GNUC_WARN_UNUSED_RESULT;
 
index ba43d6b6675e5db51e43c4c57bf26ea4c45b9a79..a4fc9e990e278fce2dcfdd463b35424efb1be8da 100644 (file)
@@ -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++)
index e0e22a133a52f05999e6a426bc138df59668cb14..c3784bb91d4e44a73b27e5c0d67e80bcd0e55680 100644 (file)
@@ -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;