[PATCH 2/4] lib: simplify u16_strdup()

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Sat Apr 2 11:46:59 CEST 2022


Use u16_strsize() instead of duplicating it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 lib/charset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/charset.c b/lib/charset.c
index 91cbe87509..de201cf3b9 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -407,7 +407,7 @@ u16 *u16_strdup(const void *src)
 
 	if (!src)
 		return NULL;
-	len = (u16_strlen(src) + 1) * sizeof(u16);
+	len = u16_strsize(src);
 	new = malloc(len);
 	if (!new)
 		return NULL;
-- 
2.34.1



More information about the U-Boot mailing list