From 6560e86b47274fe11f6781477b6e76512c0b98b4 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 29 Apr 2016 10:30:56 +0200 Subject: [PATCH] epg: small optimization in _genre_str_match() --- src/epg.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/epg.c b/src/epg.c index 5618bd4ee..4689cbd46 100644 --- a/src/epg.c +++ b/src/epg.c @@ -2342,15 +2342,14 @@ static const char *_genre_get_name(int a, int b, const char *lang) // Note: | 0x20 is a cheats (fast) way of lowering case static int _genre_str_match ( const char *a, const char *b ) { - int i = 0, j = 0; if (!a || !b) return 0; - while (a[i] != '\0' || b[j] != '\0') { - while (a[i] == ' ') i++; - while (b[j] == ' ') j++; - if ((a[i] | 0x20) != (b[j] | 0x20)) return 0; - i++; j++; + while (*a != '\0' || *b != '\0') { + while (*a == ' ') a++; + while (*b == ' ') b++; + if ((*a | 0x20) != (*b | 0x20)) return 0; + a++; b++; } - return (a[i] == '\0' && b[j] == '\0'); // end of string(both) + return (*a == '\0' && *b == '\0'); // end of string(both) } static uint8_t _epg_genre_find_by_name ( const char *name, const char *lang ) -- 2.47.3