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 9c2f062590dbb4fa0a103b0d5be13aa931e76085..da65b1f4b4d327b2eaa8608a460864b01ddf40ce 100644 (file)
--- a/cache.c
+++ b/cache.c
@@ -158,24 +158,13 @@ cache_scan(void)
                dns_send_question(&listener, s->entry, TYPE_PTR);
 }
 
-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;