aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2016-09-21 12:27:22 +0800
committerFam Zheng <famz@redhat.com>2016-09-23 11:42:52 +0800
commit9c5ce8db2e5c2769ed2fd3d91928dd1853b5ce7c (patch)
treec7fc6da1885972db475b47cbc169ebc8d7b058a6 /util
parent315d3184525c90865bf5e1ec4db5e633f1d8c7e8 (diff)
vl: Switch qemu_uuid to QemuUUID
Update all qemu_uuid users as well, especially get rid of the duplicated low level g_strdup_printf, sscanf and snprintf calls with QEMU UUID API. Since qemu_uuid_parse is quite tangled with qemu_uuid, its switching to QemuUUID is done here too to keep everything in sync and avoid code churn. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Message-Id: <1474432046-325-10-git-send-email-famz@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/uuid.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/util/uuid.c b/util/uuid.c
index f0c1eeb527..47019035bf 100644
--- a/util/uuid.c
+++ b/util/uuid.c
@@ -61,18 +61,19 @@ char *qemu_uuid_unparse_strdup(const QemuUUID *uuid)
uu[13], uu[14], uu[15]);
}
-int qemu_uuid_parse(const char *str, uint8_t *uuid)
+int qemu_uuid_parse(const char *str, QemuUUID *uuid)
{
+ unsigned char *uu = &uuid->data[0];
int ret;
if (strlen(str) != 36) {
return -1;
}
- ret = sscanf(str, UUID_FMT, &uuid[0], &uuid[1], &uuid[2], &uuid[3],
- &uuid[4], &uuid[5], &uuid[6], &uuid[7], &uuid[8], &uuid[9],
- &uuid[10], &uuid[11], &uuid[12], &uuid[13], &uuid[14],
- &uuid[15]);
+ ret = sscanf(str, UUID_FMT, &uu[0], &uu[1], &uu[2], &uu[3],
+ &uu[4], &uu[5], &uu[6], &uu[7], &uu[8], &uu[9],
+ &uu[10], &uu[11], &uu[12], &uu[13], &uu[14],
+ &uu[15]);
if (ret != 16) {
return -1;