mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
util: bitmap: Remove virBitmapNewQuiet
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>
This commit is contained in:
parent
5ea7e8b383
commit
dad2009de4
@ -1684,7 +1684,6 @@ virBitmapNew;
|
||||
virBitmapNewCopy;
|
||||
virBitmapNewData;
|
||||
virBitmapNewEmpty;
|
||||
virBitmapNewQuiet;
|
||||
virBitmapNewString;
|
||||
virBitmapNextClearBit;
|
||||
virBitmapNextSetBit;
|
||||
|
@ -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:
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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++)
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user