From: Jaroslav Kysela Date: Fri, 29 Apr 2016 08:30:56 +0000 (+0200) Subject: epg: small optimization in _genre_str_match() X-Git-Tag: v4.2.1~599 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6560e86b47274fe11f6781477b6e76512c0b98b4;p=thirdparty%2Ftvheadend.git epg: small optimization in _genre_str_match() --- 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 )