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>
*/
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
*
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;