From: Lukas Wunner Date: Wed, 3 Aug 2016 08:16:02 +0000 (+0200) Subject: lib/ucs2_string: Speed up ucs2_utf8size() X-Git-Tag: v4.9-rc1~166^2~2^2~10 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cf289cefbfde519bbc179a86cdc5e8cc91a0a08d;p=karo-tx-linux.git lib/ucs2_string: Speed up ucs2_utf8size() No need to calculate the string length on every loop iteration. Signed-off-by: Lukas Wunner Cc: Peter Jones Signed-off-by: Matt Fleming --- diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c index f0b323abb4c6..ae8d2491133c 100644 --- a/lib/ucs2_string.c +++ b/lib/ucs2_string.c @@ -56,7 +56,7 @@ ucs2_utf8size(const ucs2_char_t *src) unsigned long i; unsigned long j = 0; - for (i = 0; i < ucs2_strlen(src); i++) { + for (i = 0; src[i]; i++) { u16 c = src[i]; if (c >= 0x800)