static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
    AvahiKey *k;
    AvahiSRBLookup *n = NULL;
    AvahiRList *rl;

    assert(r->key->clazz == AVAHI_DNS_CLASS_IN);
    assert(r->key->type == AVAHI_DNS_TYPE_CNAME);

    k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type);

    for (rl = l->cname_lookups; rl; rl = rl->rlist_next) {
        n = rl->data;

        assert(n);

        if ((n->interface == AVAHI_IF_UNSPEC || n->interface == interface) &&
            (n->interface == AVAHI_PROTO_UNSPEC || n->protocol == protocol) &&
            n->flags == flags &&
            avahi_key_equal(n->key, k))
            break;
    }

    avahi_key_unref(k);

    if (rl) {
        l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, rl);
        lookup_unref(n);
    }
}
static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
    AvahiKey *k;
    AvahiSRBLookup *n = NULL;
    AvahiRList *rl;

    assert(r->key->clazz == AVAHI_DNS_CLASS_IN);
    assert(r->key->type == AVAHI_DNS_TYPE_CNAME);

    k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type);

    for (rl = l->cname_lookups; rl; rl = rl->rlist_next) {
        n = rl->data;

        assert(n);

        if ((n->interface == AVAHI_IF_UNSPEC || n->interface == interface) &&
            (n->interface == AVAHI_PROTO_UNSPEC || n->protocol == protocol) &&
            n->flags == flags &&
            avahi_key_equal(n->key, k))
            break;
    }

    avahi_key_unref(k);

    if (rl) {
        l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, rl);
        lookup_unref(n);
    }
}