From f4363e3d7ccbb0f477df26401c3bfdd797d57a50 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 4 May 2005 11:00:11 +0000 Subject: [PATCH] add a bunch of record comparison shortcuts git-svn-id: file:///home/lennart/svn/public/avahi/trunk@41 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- rr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rr.c b/rr.c index db81658..0775d45 100644 --- a/rr.c +++ b/rr.c @@ -213,6 +213,9 @@ gboolean flx_key_equal(const flxKey *a, const flxKey *b) { g_assert(a); g_assert(b); + if (a == b) + return TRUE; + /* g_message("equal: %p %p", a, b); */ return flx_domain_equal(a->name, b->name) && @@ -227,6 +230,9 @@ gboolean flx_key_pattern_match(const flxKey *pattern, const flxKey *k) { /* g_message("equal: %p %p", a, b); */ g_assert(!flx_key_is_pattern(k)); + + if (pattern == k) + return TRUE; return flx_domain_equal(pattern->name, k->name) && (pattern->type == k->type || pattern->type == FLX_DNS_TYPE_ANY) && @@ -297,6 +303,9 @@ gboolean flx_record_equal_no_ttl(const flxRecord *a, const flxRecord *b) { g_assert(a); g_assert(b); + if (a == b) + return TRUE; + return flx_key_equal(a->key, b->key) && rdata_equal(a, b); @@ -456,6 +465,9 @@ gint flx_record_lexicographical_compare(flxRecord *a, flxRecord *b) { g_assert(a); g_assert(b); + if (a == b) + return 0; + /* gchar *t; */ /* g_message("comparing [%s]", t = flx_record_to_string(a)); */ -- 2.39.5