summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSughosh Ganu <sughosh.ganu@linaro.org>2020-05-06 22:12:41 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-05-09 10:30:28 +0300
commit4835d35acfabe9fed464602fb919279036a49236 (patch)
treeb4d2c4524e761d23c23429ff49ac40a93ef2c52c /include
parent7fec249bb76db8bc21b98c08822116597154704d (diff)
downloadu-boot-4835d35acfabe9fed464602fb919279036a49236.tar.xz
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 'include')
-rw-r--r--include/charset.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/charset.h b/include/charset.h
index fde6bddbc2..c118cbeb9a 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -196,6 +196,18 @@ int u16_strncmp(const u16 *s1, const u16 *s2, size_t n);
size_t u16_strlen(const void *in);
/**
+ * u16_strsize() - count size of u16 string in bytes including the null
+ * character
+ *
+ * Counts the number of bytes occupied by a u16 string
+ *
+ * @in: null terminated u16 string
+ * Return: bytes in a u16 string
+ *
+ */
+size_t u16_strsize(const void *in);
+
+/**
* u16_strlen - count non-zero words
*
* This function matches wscnlen_s() if the -fshort-wchar compiler flag is set.