1 dd038bc6 2021-09-21 thomas.ad #include <stdlib.h>
2 dd038bc6 2021-09-21 thomas.ad #include <string.h>
3 dd038bc6 2021-09-21 thomas.ad #include <stdint.h>
4 dd038bc6 2021-09-21 thomas.ad #include <uuid/uuid.h>
6 dd038bc6 2021-09-21 thomas.ad #include "got_compat.h"
9 dd038bc6 2021-09-21 thomas.ad int32_t uuid_equal(struct uuid* a, struct uuid* b, uint32_t* unused)
11 dd038bc6 2021-09-21 thomas.ad return (uuid_compare(*(uuid_t *)a, *(uuid_t *)b) == 0);
13 dd038bc6 2021-09-21 thomas.ad int32_t uuid_is_nil(struct uuid* uuid, uint32_t* unused)
15 dd038bc6 2021-09-21 thomas.ad return uuid_is_null(*(uuid_t *)uuid);
17 dd038bc6 2021-09-21 thomas.ad void uuid_create(uuid_t *uuid, uint32_t* status)
19 dd038bc6 2021-09-21 thomas.ad *status = uuid_s_ok;
20 dd038bc6 2021-09-21 thomas.ad return uuid_generate(*(uuid_t *)uuid);
22 dd038bc6 2021-09-21 thomas.ad void uuid_create_nil(struct uuid* uuid, uint32_t* unused)
24 dd038bc6 2021-09-21 thomas.ad return uuid_clear(*(uuid_t *)uuid);
26 dd038bc6 2021-09-21 thomas.ad void uuid_from_string(const char* s, uuid_t *uuid, uint32_t *status)
28 dd038bc6 2021-09-21 thomas.ad *status = uuid_parse(s, *(uuid_t *)uuid);
30 dd038bc6 2021-09-21 thomas.ad void uuid_to_string(uuid_t *uuid, char** s, uint32_t *status)
32 dd038bc6 2021-09-21 thomas.ad *s = malloc(36 + 1); /* 36 byte uuid plus '\0' */
33 dd038bc6 2021-09-21 thomas.ad if (*s == NULL) {
34 dd038bc6 2021-09-21 thomas.ad fprintf(stderr, "uuid_to_string: fatal: malloc\n");
35 dd038bc6 2021-09-21 thomas.ad exit (1);
37 dd038bc6 2021-09-21 thomas.ad uuid_unparse(*(uuid_t *)uuid, *s);
38 dd038bc6 2021-09-21 thomas.ad *status = uuid_s_ok;