From 4835d35acfabe9fed464602fb919279036a49236 Mon Sep 17 00:00:00 2001 From: Sughosh Ganu Date: Wed, 6 May 2020 22:12:41 +0300 Subject: 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 Reviewed-by: Heinrich Schuchardt --- lib/charset.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/charset.c') diff --git a/lib/charset.c b/lib/charset.c index 1c6a7f693de..a28034ee1f1 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; -- cgit v1.2.3