[tip:efi/core] lib/ucs2_string: Speed up ucs2_utf8size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  cf289cefbfde519bbc179a86cdc5e8cc91a0a08d
Gitweb:     http://git.kernel.org/tip/cf289cefbfde519bbc179a86cdc5e8cc91a0a08d
Author:     Lukas Wunner <lukas@xxxxxxxxx>
AuthorDate: Wed, 3 Aug 2016 10:16:02 +0200
Committer:  Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx>
CommitDate: Fri, 9 Sep 2016 16:08:46 +0100

lib/ucs2_string: Speed up ucs2_utf8size()

No need to calculate the string length on every loop iteration.

Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx>
Cc: Peter Jones <pjones@xxxxxxxxxx>
Signed-off-by: Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx>
---
 lib/ucs2_string.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c
index f0b323a..ae8d249 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)
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux