diff options
| author | 2023-12-27 06:51:29 -0600 | |
|---|---|---|
| committer | 2023-12-27 06:51:29 -0600 | |
| commit | 5e141e336c3a2cb8921edcd7af6f14a29ff63942 (patch) | |
| tree | 80df676cd02693746b505aecbec5c9ee529b5e7b /src/uuid | |
| parent | refactor instances (diff) | |
add cheap SHA1 implementation
Diffstat (limited to 'src/uuid')
| -rw-r--r-- | src/uuid/uuid.c | 6 | ||||
| -rw-r--r-- | src/uuid/uuid.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/uuid/uuid.c b/src/uuid/uuid.c index 0dfcfbd..e1498fc 100644 --- a/src/uuid/uuid.c +++ b/src/uuid/uuid.c @@ -74,7 +74,7 @@ bool l2_uuid_from_string_short(uuid_t *id, const char *str) if (!l2__str_to_uint64(outid.halves + 1, str)) return false; if (!l2__str_to_uint64(outid.halves, str + 16)) return false; - memcpy(id, &outid, sizeof(uuid_t)); + l2_uuid_copy(id, &outid); return true; } @@ -83,6 +83,10 @@ int l2_uuid_compare(const uuid_t *c1, const uuid_t *c2) return memcmp(c1, c2, sizeof(uuid_t)); } +void l2_uuid_copy(uuid_t *restrict dest, const uuid_t *restrict in) { + memcpy(dest, in, sizeof(uuid_t)); +} + /* This function exists because there's not a portable way to do this. * Don't suggest strtoull, because uint64_t may not be a ulonglong. */ bool l2__str_to_uint64(uint64_t *out, const char *str) diff --git a/src/uuid/uuid.h b/src/uuid/uuid.h index 7ddeeb4..eb1d41e 100644 --- a/src/uuid/uuid.h +++ b/src/uuid/uuid.h @@ -28,5 +28,6 @@ bool l2_uuid_from_string(uuid_t *id, const char *str); bool l2_uuid_from_string_short(uuid_t *id, const char *str); int l2_uuid_compare(const uuid_t *c1, const uuid_t *c2); +void l2_uuid_copy(uuid_t *restrict dest, const uuid_t *restrict src); #endif /* include guard */ |
