utf8: automatically determine length of string if SIZE_MAX is specified
Let's make utf8_to_utf16() and utf16_to_utf8() a bit nicer to use by adding shortcuts for common cases. This is particularly relevant for utf16_to_utf8() since the multiplication with 2 is easy to forget.
This commit is contained in:
+1
-1
@@ -273,7 +273,7 @@ Architecture gpt_partition_type_uuid_to_arch(sd_id128_t id) {
|
||||
int gpt_partition_label_valid(const char *s) {
|
||||
_cleanup_free_ char16_t *recoded = NULL;
|
||||
|
||||
recoded = utf8_to_utf16(s, strlen(s));
|
||||
recoded = utf8_to_utf16(s, SIZE_MAX);
|
||||
if (!recoded)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user