mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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
|
* Returns a pointer to the allocated bitmap or NULL if
|
||||||
* memory cannot be allocated.
|
* memory cannot be allocated.
|
||||||
*/
|
*/
|
||||||
virBitmapPtr virBitmapNewData(void *data, int len)
|
virBitmapPtr virBitmapNewData(const void *data, int len)
|
||||||
{
|
{
|
||||||
virBitmapPtr bitmap;
|
virBitmapPtr bitmap;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
unsigned long *p;
|
unsigned long *p;
|
||||||
unsigned char *bytes = data;
|
const unsigned char *bytes = data;
|
||||||
|
|
||||||
bitmap = virBitmapNew(len * CHAR_BIT);
|
bitmap = virBitmapNew(len * CHAR_BIT);
|
||||||
if (!bitmap)
|
if (!bitmap)
|
||||||
@ -1058,7 +1058,7 @@ virBitmapCountBits(virBitmapPtr bitmap)
|
|||||||
* Returns: a string representation of the data, or NULL on error
|
* Returns: a string representation of the data, or NULL on error
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
virBitmapDataToString(void *data,
|
virBitmapDataToString(const void *data,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
virBitmapPtr map = NULL;
|
virBitmapPtr map = NULL;
|
||||||
|
@ -101,7 +101,7 @@ virBitmapParseUnlimited(const char *str,
|
|||||||
|
|
||||||
virBitmapPtr virBitmapNewCopy(virBitmapPtr src) ATTRIBUTE_NONNULL(1);
|
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)
|
int virBitmapToData(virBitmapPtr bitmap, unsigned char **data, int *dataLen)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
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)
|
size_t virBitmapCountBits(virBitmapPtr bitmap)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
char *virBitmapDataToString(void *data,
|
char *virBitmapDataToString(const void *data,
|
||||||
int len)
|
int len)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
bool virBitmapOverlaps(virBitmapPtr b1,
|
bool virBitmapOverlaps(virBitmapPtr b1,
|
||||||
|
Loading…
Reference in New Issue
Block a user