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
@@ -265,7 +265,7 @@ finish:
|
||||
int efi_set_variable_string(const char *variable, const char *value) {
|
||||
_cleanup_free_ char16_t *u16 = NULL;
|
||||
|
||||
u16 = utf8_to_utf16(value, strlen(value));
|
||||
u16 = utf8_to_utf16(value, SIZE_MAX);
|
||||
if (!u16)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user