Skip to content

Commit

Permalink
lib/ucs2_string: Speed up ucs2_utf8size()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lukas Wunner authored and Matt Fleming committed Sep 9, 2016
1 parent d520dd1 commit cf289ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ucs2_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cf289ce

Please sign in to comment.