On Thu, 2015-10-29 at 01:29 +0200, pasi.sjoh...@jolla.com wrote: > From: Pasi Sjöholm <pasi.sjoh...@jollamobile.com> > > A new append_domain()- and remove_domain()-functions which both > call append_or_remove_domain()-function by setting boolean append- > variable accordingly. > > This enables a capability to remove domains from the dns-server's > domain list. > --- > src/dnsproxy.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/src/dnsproxy.c b/src/dnsproxy.c > index c37eee9..1e8fcfb 100644 > --- a/src/dnsproxy.c > +++ b/src/dnsproxy.c > @@ -2649,7 +2649,7 @@ static bool resolv(struct request_data *req, > return false; > } > > -static void append_domain(int index, const char *domain) > +static void append_or_remove_domain(int index, const char *domain, bool > append) > { > GSList *list; > > @@ -2680,13 +2680,26 @@ static void append_domain(int index, const char > *domain) > } > } > > - if (!dom_found) { > + if (!dom_found && append) { > data->domains = > g_list_append(data->domains, g_strdup(domain)); > + } else if (dom_found && !append) { > + data->domains = > + g_list_remove(data->domains, dom); > } > } > } > > +static void append_domain(int index, const char *domain) > +{ > + append_or_remove_domain(index, domain, true); > +} > + > +static void remove_domain(int index, const char *domain) > +{ > + append_or_remove_domain(index, domain, false); > +} > +
remove_domain() belongs to the next patch, as gcc says: CC src/src_connmand-dnsproxy.o src/dnsproxy.c:2698:13: error: ‘remove_domain’ defined but not used [-Werror=unused-function] static void remove_domain(int index, const char *domain) ^ At the same time, could the append_or_remove_domain() function be simply called update_domain() ? > static void flush_requests(struct server_data *server) > { > GSList *list; Cheers, Patrik _______________________________________________ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman