From 1f854740a04fad3f36ac912514c48d59ca6cffec Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Thu, 24 May 2012 16:25:01 +0300 Subject: [PATCH] resolver: Clean up remove function A search domain will have it's server attribute set to NULL, thus remove that explicit check. Also when comparing entry elements to the given attributes, consider NULL being equal to NULL. --- src/resolver.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/resolver.c b/src/resolver.c index 3ce74c3..a9d1341 100644 --- a/src/resolver.c +++ b/src/resolver.c @@ -450,23 +450,20 @@ int connman_resolver_remove(const char *interface, const char *domain, DBG("interface %s domain %s server %s", interface, domain, server); - if (server == NULL) - return -EINVAL; - for (list = entry_list; list; list = list->next) { struct entry_data *entry = list->data; - if (interface != NULL && - g_strcmp0(entry->interface, interface) != 0) + if (g_strcmp0(entry->interface, interface) != 0) continue; - if (domain != NULL && g_strcmp0(entry->domain, domain) != 0) + if (g_strcmp0(entry->domain, domain) != 0) continue; if (g_strcmp0(entry->server, server) != 0) continue; matches = g_slist_append(matches, entry); + break; } if (matches == NULL) -- 2.7.4