From dc477e7385e8ab29efb8fadb72ec994077a105c6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 25 Nov 2015 21:07:17 +0100 Subject: dns-domain: simplify dns_name_is_root() and dns_name_is_single_label() Let's change the return value to bool. If we encounter an error while parsing, return "false" instead of the actual parsing error, after all the specified hostname does not qualify for what the function is supposed to test. Dealing with the additional error codes was always cumbersome, and easily misused, like for example in the DHCP code. Let's also rename the functions from dns_name_root() to dns_name_is_root(), to indicate that this function checks something and returns a bool. Similar for dns_name_is_signal_label(). --- src/resolve/resolved-dns-rr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/resolve/resolved-dns-rr.c') diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index 4f896b05af..4a1abb0cdc 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -95,10 +95,7 @@ int dns_resource_key_new_append_suffix(DnsResourceKey **ret, DnsResourceKey *key assert(key); assert(name); - r = dns_name_root(name); - if (r < 0) - return r; - if (r > 0) { + if (dns_name_is_root(name)) { *ret = dns_resource_key_ref(key); return 0; } -- cgit v1.2.3-54-g00ecf