resolve: slightly shorten dns_resource_key_compare_func()

This commit is contained in:
Yu Watanabe 2020-12-29 22:29:21 +09:00
parent e9665ac2a2
commit 600864921b
1 changed files with 8 additions and 12 deletions

View File

@ -294,21 +294,17 @@ static void dns_resource_key_hash_func(const DnsResourceKey *k, struct siphash *
} }
static int dns_resource_key_compare_func(const DnsResourceKey *x, const DnsResourceKey *y) { static int dns_resource_key_compare_func(const DnsResourceKey *x, const DnsResourceKey *y) {
int ret; int r;
ret = dns_name_compare_func(dns_resource_key_name(x), dns_resource_key_name(y)); r = dns_name_compare_func(dns_resource_key_name(x), dns_resource_key_name(y));
if (ret != 0) if (r != 0)
return ret; return r;
ret = CMP(x->type, y->type); r = CMP(x->type, y->type);
if (ret != 0) if (r != 0)
return ret; return r;
ret = CMP(x->class, y->class); return CMP(x->class, y->class);
if (ret != 0)
return ret;
return 0;
} }
DEFINE_HASH_OPS(dns_resource_key_hash_ops, DnsResourceKey, dns_resource_key_hash_func, dns_resource_key_compare_func); DEFINE_HASH_OPS(dns_resource_key_hash_ops, DnsResourceKey, dns_resource_key_hash_func, dns_resource_key_compare_func);