sd-id128: parse UUID URNs

Accept RFC4122 UUID URN strings with the `urn:uuid:` prefix in
sd_id128_from_string(), while keeping plain 128-bit IDs and regular
UUID strings working as before.
This commit is contained in:
dongshengyuan
2026-08-02 19:17:03 +09:00
committed by Yu Watanabe
parent 574eed3b0d
commit 3bb3c54f3d
4 changed files with 24 additions and 4 deletions
+4 -2
View File
@@ -78,8 +78,10 @@
character string with 32 hexadecimal digits (either lowercase or uppercase, terminated by
<constant>NUL</constant>) and parses them back into a 128-bit ID returned in
<parameter>ret</parameter>. Alternatively, this call can also parse a 37-character string with a 128-bit
ID formatted as RFC UUID. If <parameter>ret</parameter> is passed as <constant>NULL</constant> the
function will validate the passed ID string, but not actually return it in parsed form.</para>
ID formatted as RFC UUID, and a 46-character string consisting of the 9-character
<literal>urn:uuid:</literal> prefix, a 36-character RFC UUID, and a terminating
<constant>NUL</constant>. If <parameter>ret</parameter> is passed as <constant>NULL</constant> the function
will validate the passed ID string, but not actually return it in parsed form.</para>
<para>Note that when formatting and parsing 36 character UUIDs this is done strictly in Big Endian byte order,
i.e. according to <ulink url="https://tools.ietf.org/html/rfc4122">RFC4122</ulink> Variant 1 rules, even