Browse Source

lib/ucs2_string: Speed up ucs2_utf8size()

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

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: Peter Jones <pjones@redhat.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Lukas Wunner 9 years ago
parent
commit
cf289cefbf
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/ucs2_string.c

+ 1 - 1
lib/ucs2_string.c

@@ -56,7 +56,7 @@ ucs2_utf8size(const ucs2_char_t *src)
 	unsigned long i;
 	unsigned long i;
 	unsigned long j = 0;
 	unsigned long j = 0;
 
 
-	for (i = 0; i < ucs2_strlen(src); i++) {
+	for (i = 0; src[i]; i++) {
 		u16 c = src[i];
 		u16 c = src[i];
 
 
 		if (c >= 0x800)
 		if (c >= 0x800)