]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: use CMP() in dns_resource_record_compare_func
authorFilipe Brandenburger <filbranden@google.com>
Tue, 7 Aug 2018 02:21:38 +0000 (19:21 -0700)
committerFilipe Brandenburger <filbranden@google.com>
Tue, 7 Aug 2018 02:26:44 +0000 (19:26 -0700)
This function doesn't really implement ordering, but CMP() is still fine to use
there. Keep the comment in place, just update it slightly to indicate that.

src/resolve/resolved-dns-rr.c

index 05a4915101e0cd299f5e2f20003bf1e76e0c6e8f..e6d997ed9768be01300ccbb34e0fb418cfe1be17 100644 (file)
@@ -1513,10 +1513,9 @@ static int dns_resource_record_compare_func(const void *a, const void *b) {
         if (dns_resource_record_equal(x, y))
                 return 0;
 
-        /* This is a bit dirty, we don't implement proper ordering, but
-         * the hashtable doesn't need ordering anyway, hence we don't
-         * care. */
-        return x < y ? -1 : 1;
+        /* We still use CMP() here, even though don't implement proper
+         * ordering, since the hashtable doesn't need ordering anyway. */
+        return CMP(x, y);
 }
 
 const struct hash_ops dns_resource_record_hash_ops = {