X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Frrlist.c;h=0a794abafbd6c2ceae175558b682cecacd47edb5;hb=9c0f9c65093cfa53d45f9b68782321eb8063a032;hp=915ecbb87bccb3297e5d5187c6d4d4978ebfdf33;hpb=da75d1898a45c106a994cd87f8da5b6bcb2b6450;p=catta diff --git a/avahi-core/rrlist.c b/avahi-core/rrlist.c index 915ecbb..0a794ab 100644 --- a/avahi-core/rrlist.c +++ b/avahi-core/rrlist.c @@ -1,18 +1,16 @@ -/* $Id$ */ - /*** This file is part of avahi. - + avahi is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + avahi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with avahi; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -57,7 +55,7 @@ AvahiRecordList *avahi_record_list_new(void) { avahi_log_error("avahi_new() failed."); return NULL; } - + AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->read); AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->unread); @@ -76,18 +74,18 @@ static void item_free(AvahiRecordList *l, AvahiRecordListItem *i) { assert(l); assert(i); - if (i->read) + if (i->read) AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->read, i); else AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i); - + avahi_record_unref(i->record); avahi_free(i); } void avahi_record_list_flush(AvahiRecordList *l) { assert(l); - + while (l->read) item_free(l, l->read); while (l->unread) @@ -104,7 +102,7 @@ AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, in return NULL; assert(!i->read); - + r = avahi_record_ref(i->record); if (ret_unicast_response) *ret_unicast_response = i->unicast_response; @@ -117,7 +115,7 @@ AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, in AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->read, i); i->read = 1; - + return r; } @@ -126,7 +124,7 @@ static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) { assert(l); assert(r); - + for (i = l->read; i; i = i->items_next) if (avahi_record_equal_no_ttl(i->record, r)) return i; @@ -140,7 +138,7 @@ static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) { void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, int unicast_response, int auxiliary) { AvahiRecordListItem *i; - + assert(l); assert(r); @@ -151,7 +149,7 @@ void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, avahi_log_error("avahi_new() failed."); return; } - + i->unicast_response = unicast_response; i->flush_cache = flush_cache; i->auxiliary = auxiliary; @@ -159,7 +157,7 @@ void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, i->read = 0; l->all_flush_cache = l->all_flush_cache && flush_cache; - + AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->unread, i); } @@ -177,7 +175,7 @@ void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r) { int avahi_record_list_is_empty(AvahiRecordList *l) { assert(l); - + return !l->unread && !l->read; } @@ -185,6 +183,6 @@ int avahi_record_list_all_flush_cache(AvahiRecordList *l) { assert(l); /* Return TRUE if all entries in this list have flush_cache set */ - + return l->all_flush_cache; }