mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
libxl: const-ify libxl_uuid_*() API
Add const to parameters of libxl_uuid_*() calls where it does not change the API. Add libxl_uuid_byte_array_const() to return a const array. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
171c6d7ac1
commit
4e98cff291
2 files changed
+17
-6
No files matched your search
@@ -20,7 +20,7 @@
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
int libxl_uuid_is_nil(libxl_uuid *uuid)
|
||||
int libxl_uuid_is_nil(const libxl_uuid *uuid)
|
||||
{
|
||||
return uuid_is_null(uuid->uuid);
|
||||
}
|
||||
@@ -45,11 +45,16 @@ void libxl_uuid_clear(libxl_uuid *uuid)
|
||||
uuid_clear(uuid->uuid);
|
||||
}
|
||||
|
||||
int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
|
||||
int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2)
|
||||
{
|
||||
return uuid_compare(uuid1->uuid, uuid2->uuid);
|
||||
}
|
||||
|
||||
const uint8_t *libxl_uuid_bytearray_const(const libxl_uuid *uuid)
|
||||
{
|
||||
return uuid->uuid;
|
||||
}
|
||||
|
||||
uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
|
||||
{
|
||||
return uuid->uuid;
|
||||
@@ -57,7 +62,7 @@ uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
|
||||
int libxl_uuid_is_nil(libxl_uuid *uuid)
|
||||
int libxl_uuid_is_nil(const libxl_uuid *uuid)
|
||||
{
|
||||
uint32_t status;
|
||||
return uuid_is_nil((uuid_t *)uuid->uuid, &status);
|
||||
@@ -92,11 +97,16 @@ void libxl_uuid_clear(libxl_uuid *uuid)
|
||||
memset(uuid->uuid, 0, sizeof(uuid->uuid));
|
||||
}
|
||||
|
||||
int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
|
||||
int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2)
|
||||
{
|
||||
return memcmp(uuid1->uuid, uuid2->uuid, sizeof(uuid1->uuid));
|
||||
}
|
||||
|
||||
const uint8_t *libxl_uuid_bytearray_const(const libxl_uuid *uuid)
|
||||
{
|
||||
return uuid->uuid;
|
||||
}
|
||||
|
||||
uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
|
||||
{
|
||||
return uuid->uuid;
|
||||
|
||||
@@ -53,12 +53,13 @@ typedef struct {
|
||||
|
||||
#endif
|
||||
|
||||
int libxl_uuid_is_nil(libxl_uuid *uuid);
|
||||
int libxl_uuid_is_nil(const libxl_uuid *uuid);
|
||||
void libxl_uuid_generate(libxl_uuid *uuid);
|
||||
int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);
|
||||
void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src);
|
||||
void libxl_uuid_clear(libxl_uuid *uuid);
|
||||
int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2);
|
||||
int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2);
|
||||
const uint8_t *libxl_uuid_bytearray_const(const libxl_uuid *uuid);
|
||||
uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);
|
||||
|
||||
#endif /* __LIBXL_UUID_H__ */
|
||||
|
||||