summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-id128/id128-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-02-14 14:54:24 +0100
committerLennart Poettering <lennart@poettering.net>2022-02-14 15:14:03 +0100
commit75a505c6006f9ddf536b426941ace1f87b263399 (patch)
tree8fc3102d92c2bcb91cf3efbf6767c16a6eb90789 /src/libsystemd/sd-id128/id128-util.h
parentb74163607b4e513288d38b7f16e230f5a61400c0 (diff)
downloadsystemd-75a505c6006f9ddf536b426941ace1f87b263399.tar.gz
id128-util: add new helper id128_equal_string()
Quite often we compare uuids/id128 formatted as strings with specific values. So far we usually used streq() for that. let's add a new explicit helper for this in id128_equal_string() that compares a string with an sd_id128_t and is more robust than a simple string comparison. Moreover, we can mroe easily reuse the various defines we have for specific UUIDs, for example those from gpt.h.
Diffstat (limited to 'src/libsystemd/sd-id128/id128-util.h')
-rw-r--r--src/libsystemd/sd-id128/id128-util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsystemd/sd-id128/id128-util.h b/src/libsystemd/sd-id128/id128-util.h
index 17b180c10c..65a278c8ee 100644
--- a/src/libsystemd/sd-id128/id128-util.h
+++ b/src/libsystemd/sd-id128/id128-util.h
@@ -34,3 +34,5 @@ extern const struct hash_ops id128_hash_ops;
sd_id128_t id128_make_v4_uuid(sd_id128_t id);
int id128_get_product(sd_id128_t *ret);
+
+int id128_equal_string(const char *s, sd_id128_t id);