Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
epg: small optimization in _genre_str_match()
  • Loading branch information
perexg committed Apr 29, 2016
1 parent 5374573 commit 6560e86
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/epg.c
Expand Up @@ -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 )
Expand Down

0 comments on commit 6560e86

Please sign in to comment.