提交 3507af63 编写于 作者: P Peter Krempa

util: bitmap: Make bitmaps const in virBitmapNewData and virBitmapDataToString

The functions just read the passed pointer so it can be marked as const.
上级 2273bbd4
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册