From: Felix Fietkau Date: Tue, 3 Jun 2014 21:32:41 +0000 (+0200) Subject: cache: use proper avl lookup for entries X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d76c21865eed783deb18a34a4f497f3da50320c9;p=project%2Fmdnsd.git cache: use proper avl lookup for entries Signed-off-by: Felix Fietkau --- diff --git a/cache.c b/cache.c index 9c2f062..da65b1f 100644 --- 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;