From 8cfbd4f4eb61be673a5f0d8966bc8a56f543a537 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 11 Mar 2019 17:23:21 -0400 Subject: [PATCH] Add lttng_uuid_is_equal util to lttng_uuid MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- src/common/compat/uuid.c | 6 ++++++ src/common/compat/uuid.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/common/compat/uuid.c b/src/common/compat/uuid.c index 4f7e3a72b..6d8993dd3 100644 --- a/src/common/compat/uuid.c +++ b/src/common/compat/uuid.c @@ -17,6 +17,7 @@ #include #include +#include void lttng_uuid_to_str(const lttng_uuid uuid, char *uuid_str) { @@ -27,3 +28,8 @@ void lttng_uuid_to_str(const lttng_uuid uuid, char *uuid_str) uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]); } + +bool lttng_uuid_is_equal(const lttng_uuid a, const lttng_uuid b) +{ + return memcmp(a, b, (sizeof(lttng_uuid))) == 0; +} diff --git a/src/common/compat/uuid.h b/src/common/compat/uuid.h index 0da0b80db..e1e3c749d 100644 --- a/src/common/compat/uuid.h +++ b/src/common/compat/uuid.h @@ -24,6 +24,7 @@ #define LTTNG_UUID_H #include +#include /* * Includes final \0. @@ -78,4 +79,7 @@ int lttng_uuid_generate(lttng_uuid uuid_out) LTTNG_HIDDEN void lttng_uuid_to_str(const lttng_uuid uuid, char *uuid_str); +LTTNG_HIDDEN +bool lttng_uuid_is_equal(const lttng_uuid a, const lttng_uuid b); + #endif /* LTTNG_UUID_H */ -- 2.34.1