cache: use proper avl lookup for entries
authorFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2014 21:32:41 +0000 (23:32 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 3 Jun 2014 21:32:41 +0000 (23:32 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
cache.c

diff --git a/cache.c b/cache.c
index 9c2f062..da65b1f 100644 (file)
--- a/cache.c
+++ b/cache.c
@@ -159,23 +159,12 @@ cache_scan(void)
 }
 
 static struct cache_entry*
-cache_find_entry(char *entry)
-{
-       struct cache_entry *s;
-
-       avl_for_each_element(&entries, s, avl)
-               if (!strcmp(s->entry, entry))
-                       return s;
-       return NULL;
-}
-
-static struct cache_entry*
 cache_entry(struct uloop_fd *u, char *entry, int hlen, int ttl)
 {
        struct cache_entry *s;
        char *type;
 
-       s = cache_find_entry(entry);
+       s = avl_find_element(&entries, entry, s, avl);
        if (s)
                return s;