summaryrefslogtreecommitdiff
path: root/apps/tagcache.c
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-08-13 14:53:19 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-08-13 14:53:19 +0000
commite5059a7b0d056044299f6ef601b59296c0ebd42c (patch)
treea1e709231e479e288b9c99cde288a259cd7043bb /apps/tagcache.c
parent33d91040785d679c40a44f3127eee54d6adb2ad3 (diff)
FS#5806 with code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10559 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r--apps/tagcache.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 87810da93b..08d6894e57 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -578,6 +578,17 @@ long tagcache_get_numeric(const struct tagcache_search *tcs, int tag)
return check_virtual_tags(tag, &idx);
}
+inline static bool str_ends_with(const char *str1, const char *str2)
+{
+ int str_len = strlen(str1);
+ int clause_len = strlen(str2);
+
+ if (clause_len > str_len)
+ return false;
+
+ return !strcasecmp(&str1[str_len - clause_len], str2);
+}
+
static bool check_against_clause(long numeric, const char *str,
const struct tagcache_search_clause *clause)
{
@@ -610,13 +621,13 @@ static bool check_against_clause(long numeric, const char *str,
case clause_begins_with:
return (strcasestr(str, clause->str) == str);
case clause_not_begins_with:
- return (strcasestr(str, clause->str) != str);
- case clause_ends_with: /* Not supported yet */
- return false;
- case clause_not_ends_with: /* Not supported yet */
- return false;
+ return (strcasestr(str, clause->str) != str);
+ case clause_ends_with:
+ return str_ends_with(str, clause->str);
+ case clause_not_ends_with:
+ return !str_ends_with(str, clause->str);
}
-
+
return false;
}