sd128: export sd_id128_to_uuid_string()

We expose various other forms of UUID helpers already, i.e.
SD_ID128_UUID_FORMAT_STR and SD_ID128_MAKE_UUID_STR(), and we parse
UUIDs, hence add a high-level helper for formatting UUIDs too.

This doesn't add any new code, it just moves some helpers
id128-util.[ch] → sd-id128.[ch], to make them public.
This commit is contained in:
Lennart Poettering
2022-02-14 15:13:23 +01:00
parent fdf9de694f
commit b74163607b
20 changed files with 96 additions and 76 deletions
+3 -3
View File
@@ -1699,11 +1699,11 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
case TABLE_UUID: {
char *p;
p = new(char, ID128_UUID_STRING_MAX);
p = new(char, SD_ID128_UUID_STRING_MAX);
if (!p)
return NULL;
d->formatted = id128_to_uuid_string(d->id128, p);
d->formatted = sd_id128_to_uuid_string(d->id128, p);
break;
}
@@ -2562,7 +2562,7 @@ static int table_data_to_json(TableData *d, JsonVariant **ret) {
return json_variant_new_string(ret, SD_ID128_TO_STRING(d->id128));
case TABLE_UUID:
return json_variant_new_string(ret, ID128_TO_UUID_STRING(d->id128));
return json_variant_new_string(ret, SD_ID128_TO_UUID_STRING(d->id128));
case TABLE_UID:
if (!uid_is_valid(d->uid))