From: Jérémie Galarneau Date: Tue, 12 Mar 2019 20:53:00 +0000 (-0400) Subject: Add lttng_uuid_is_nil() util X-Git-Tag: v2.11.0-rc3~134 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c852c4b6917de38cac4f34a60e3d2162edf76109;p=lttng-tools.git Add lttng_uuid_is_nil() util Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/compat/uuid.c b/src/common/compat/uuid.c index 6d8993dd3..25dccbb83 100644 --- a/src/common/compat/uuid.c +++ b/src/common/compat/uuid.c @@ -18,6 +18,9 @@ #include #include #include +#include + +static const lttng_uuid nil_uuid; void lttng_uuid_to_str(const lttng_uuid uuid, char *uuid_str) { @@ -33,3 +36,8 @@ bool lttng_uuid_is_equal(const lttng_uuid a, const lttng_uuid b) { return memcmp(a, b, (sizeof(lttng_uuid))) == 0; } + +bool lttng_uuid_is_nil(const lttng_uuid uuid) +{ + return memcmp(nil_uuid, uuid, sizeof(lttng_uuid)) == 0; +} diff --git a/src/common/compat/uuid.h b/src/common/compat/uuid.h index e1e3c749d..ade7ef56d 100644 --- a/src/common/compat/uuid.h +++ b/src/common/compat/uuid.h @@ -82,4 +82,7 @@ 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); +LTTNG_HIDDEN +bool lttng_uuid_is_nil(const lttng_uuid uuid); + #endif /* LTTNG_UUID_H */