mirror of https://gitee.com/openkylin/libvirt.git
util: bitmap: Make bitmaps const in virBitmapNewData and virBitmapDataToString
The functions just read the passed pointer so it can be marked as const.
This commit is contained in:
parent
2273bbd457
commit
3507af63ae
|
@ -689,12 +689,12 @@ virBitmapPtr virBitmapNewCopy(virBitmapPtr src)
|
|||
* Returns a pointer to the allocated bitmap or NULL if
|
||||
* memory cannot be allocated.
|
||||
*/
|
||||
virBitmapPtr virBitmapNewData(void *data, int len)
|
||||
virBitmapPtr virBitmapNewData(const void *data, int len)
|
||||
{
|
||||
virBitmapPtr bitmap;
|
||||
size_t i, j;
|
||||
unsigned long *p;
|
||||
unsigned char *bytes = data;
|
||||
const unsigned char *bytes = data;
|
||||
|
||||
bitmap = virBitmapNew(len * CHAR_BIT);
|
||||
if (!bitmap)
|
||||
|
@ -1058,7 +1058,7 @@ virBitmapCountBits(virBitmapPtr bitmap)
|
|||
* Returns: a string representation of the data, or NULL on error
|
||||
*/
|
||||
char *
|
||||
virBitmapDataToString(void *data,
|
||||
virBitmapDataToString(const void *data,
|
||||
int len)
|
||||
{
|
||||
virBitmapPtr map = NULL;
|
||||
|
|
|
@ -101,7 +101,7 @@ virBitmapParseUnlimited(const char *str,
|
|||
|
||||
virBitmapPtr virBitmapNewCopy(virBitmapPtr src) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
virBitmapPtr virBitmapNewData(void *data, int len) ATTRIBUTE_NONNULL(1);
|
||||
virBitmapPtr virBitmapNewData(const void *data, int len) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int virBitmapToData(virBitmapPtr bitmap, unsigned char **data, int *dataLen)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
|
@ -138,7 +138,7 @@ ssize_t virBitmapNextClearBit(virBitmapPtr bitmap, ssize_t pos)
|
|||
size_t virBitmapCountBits(virBitmapPtr bitmap)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
char *virBitmapDataToString(void *data,
|
||||
char *virBitmapDataToString(const void *data,
|
||||
int len)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
bool virBitmapOverlaps(virBitmapPtr b1,
|
||||
|
|
Loading…
Reference in New Issue