diff options
author | Sughosh Ganu <sughosh.ganu@linaro.org> | 2020-05-06 22:12:41 +0300 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-05-09 09:30:28 +0200 |
commit | 4835d35acfabe9fed464602fb919279036a49236 (patch) | |
tree | b4d2c4524e761d23c23429ff49ac40a93ef2c52c /lib | |
parent | 7fec249bb76db8bc21b98c08822116597154704d (diff) | |
download | u-boot-4835d35acfabe9fed464602fb919279036a49236.tar.gz |
charset: Add support for calculating bytes occupied by a u16 string
The current code uses 'u16_strlen(x) + 1) * sizeof(u16)' in various
places to calculate the number of bytes occupied by a u16 string.
Let's introduce a wrapper around this. This wrapper is used on following
patches
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/charset.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/charset.c b/lib/charset.c index 1c6a7f693d..a28034ee1f 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -379,6 +379,11 @@ size_t u16_strnlen(const u16 *in, size_t count) return i; } +size_t u16_strsize(const void *in) +{ + return (u16_strlen(in) + 1) * sizeof(u16); +} + u16 *u16_strcpy(u16 *dest, const u16 *src) { u16 *tmp = dest; |