From: Jérémie Galarneau Date: Mon, 11 Mar 2019 21:23:21 +0000 (-0400) Subject: Add lttng_uuid_is_equal util to lttng_uuid X-Git-Tag: v2.12.0-rc1~567 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8cfbd4f4eb61be673a5f0d8966bc8a56f543a537;p=lttng-tools.git Add lttng_uuid_is_equal util to lttng_uuid Signed-off-by: Jérémie Galarneau --- 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 */