Skip to content

Commit cf289ce

Browse files
l1kmfleming
authored andcommitted
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>
1 parent d520dd1 commit cf289ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ucs2_string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ucs2_utf8size(const ucs2_char_t *src)
5656
unsigned long i;
5757
unsigned long j = 0;
5858

59-
for (i = 0; i < ucs2_strlen(src); i++) {
59+
for (i = 0; src[i]; i++) {
6060
u16 c = src[i];
6161

6262
if (c >= 0x800)

0 commit comments

Comments
 (0)