mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
efi_loader: rename utf16_strlen, utf16_strnlen
The function names utf16_strlen() and utf16_strnlen() are misnomers. The functions do not count utf-16 characters but non-zero words. So let's rename them to u16_strlen and u16_strnlen(). In utf16_dup() avoid assignment in if clause. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:

committed by
Alexander Graf

parent
fbb3ea806f
commit
1dde0d57a5
@ -12,14 +12,14 @@
|
||||
* utf8/utf16 conversion mostly lifted from grub
|
||||
*/
|
||||
|
||||
size_t utf16_strlen(const uint16_t *in)
|
||||
size_t u16_strlen(const u16 *in)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; in[i]; i++);
|
||||
return i;
|
||||
}
|
||||
|
||||
size_t utf16_strnlen(const uint16_t *in, size_t count)
|
||||
size_t u16_strnlen(const u16 *in, size_t count)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; count-- && in[i]; i++);
|
||||
@ -39,7 +39,11 @@ uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src)
|
||||
uint16_t *utf16_strdup(const uint16_t *s)
|
||||
{
|
||||
uint16_t *new;
|
||||
if (!s || !(new = malloc((utf16_strlen(s) + 1) * 2)))
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
new = malloc((u16_strlen(s) + 1) * 2);
|
||||
if (!new)
|
||||
return NULL;
|
||||
utf16_strcpy(new, s);
|
||||
return new;
|
||||
|
Reference in New Issue
Block a user