From: Lennart Poettering Date: Thu, 5 Jan 2023 15:18:31 +0000 (+0100) Subject: dns-domain: dns_name_is_empty() is redundant X-Git-Tag: v253-rc1~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=218db3d9ef7af3021304322e6903835afd10580d;p=thirdparty%2Fsystemd.git dns-domain: dns_name_is_empty() is redundant dns_name_is_empty() was added later, but does the same thing as the more accurately called dns_name_is_root(), hence drop the former. --- diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index 0c062efc985..7b82ae2b458 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -649,11 +649,11 @@ DnsScopeMatch dns_scope_good_domain( DnsScopeMatch m; int n_best = -1; - if (dns_name_is_empty(domain)) { + if (dns_name_is_root(domain)) { DnsResourceKey *t; bool found = false; - /* Refuse empty name if only A and/or AAAA records are requested. */ + /* Refuse root name if only A and/or AAAA records are requested. */ DNS_QUESTION_FOREACH(t, question) if (!IN_SET(t->type, DNS_TYPE_A, DNS_TYPE_AAAA)) { diff --git a/src/resolve/resolved-dns-synthesize.c b/src/resolve/resolved-dns-synthesize.c index 51e06bb91ea..5bde29c704b 100644 --- a/src/resolve/resolved-dns-synthesize.c +++ b/src/resolve/resolved-dns-synthesize.c @@ -463,7 +463,7 @@ int dns_synthesize_answer( name = dns_resource_key_name(key); - if (dns_name_is_empty(name)) { + if (dns_name_is_root(name)) { /* Do nothing. */ } else if (dns_name_dont_resolve(name)) { diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c index d209e17f952..620b1565633 100644 --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c @@ -832,7 +832,6 @@ int dns_name_address(const char *p, int *ret_family, union in_addr_union *ret_ad } bool dns_name_is_root(const char *name) { - assert(name); /* There are exactly two ways to encode the root domain name: diff --git a/src/shared/dns-domain.h b/src/shared/dns-domain.h index 7a35ae43bcb..331fb89637c 100644 --- a/src/shared/dns-domain.h +++ b/src/shared/dns-domain.h @@ -60,10 +60,6 @@ static inline int dns_name_is_valid_ldh(const char *s) { return 1; } -static inline bool dns_name_is_empty(const char *s) { - return isempty(s) || streq(s, "."); -} - void dns_name_hash_func(const char *s, struct siphash *state); int dns_name_compare_func(const char *a, const char *b); extern const struct hash_ops dns_name_hash_ops;