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.
This commit is contained in:
Lennart Poettering 2023-01-05 16:18:31 +01:00
parent ef503f1cec
commit 218db3d9ef
4 changed files with 3 additions and 8 deletions

View file

@ -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)) {

View file

@ -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)) {

View file

@ -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:

View file

@ -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;