X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Frr.c;h=f3db5845d539e8fc6067e5c4e1036d02525b71d8;hb=22a61b042376903deada022e7585e0585aaa7d43;hp=5b5ec7ec8d45d3836b34a2eaf35949c9683eb54e;hpb=f5a4db2039532ef93fbb3d98fa048be9d74a83fe;p=catta diff --git a/avahi-core/rr.c b/avahi-core/rr.c index 5b5ec7e..f3db584 100644 --- a/avahi-core/rr.c +++ b/avahi-core/rr.c @@ -181,6 +181,9 @@ const gchar *avahi_dns_type_to_string(guint16 type) { gchar *avahi_key_to_string(const AvahiKey *k) { + g_assert(k); + g_assert(k->ref >= 1); + return g_strdup_printf("%s\t%s\t%s", k->name, avahi_dns_class_to_string(k->class), @@ -191,6 +194,9 @@ gchar *avahi_record_to_string(const AvahiRecord *r) { gchar *p, *s; char buf[257], *t = NULL, *d = NULL; + g_assert(r); + g_assert(r->ref >= 1); + switch (r->key->type) { case AVAHI_DNS_TYPE_A: inet_ntop(AF_INET, &r->data.a.address.address, t = buf, sizeof(buf)); @@ -452,12 +458,12 @@ static gint lexicographical_memcmp(gconstpointer a, size_t al, gconstpointer b, } static gint uint16_cmp(guint16 a, guint16 b) { - return a == b ? 0 : (a < b ? a : b); + return a == b ? 0 : (a < b ? -1 : 1); } gint avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) { gint r; -/* gchar *t1, *t2; */ +/* gchar *t1, *t2; */ g_assert(a); g_assert(b); @@ -529,3 +535,9 @@ gint avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) { } } + +gboolean avahi_record_is_goodbye(AvahiRecord *r) { + g_assert(r); + + return r->ttl == 0; +}