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:
Peter Krempa 2016-09-29 12:56:58 +02:00
parent 2273bbd457
commit 3507af63ae
2 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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,