]> git.meshlink.io Git - catta/blobdiff - src/rrlist.c
rename everything avahi to catta
[catta] / src / rrlist.c
index 04af0fa7464e2789e0938186020952f39139696e..2ccfdf72be4f38d4b15ba6a419a4643208620224 100644 (file)
@@ -1,18 +1,18 @@
 /***
-  This file is part of avahi.
+  This file is part of catta.
 
-  avahi is free software; you can redistribute it and/or modify it
+  catta 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
+  catta 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
+  License along with catta; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   USA.
 ***/
 #include <stdlib.h>
 #include <assert.h>
 
-#include <avahi/llist.h>
-#include <avahi/malloc.h>
+#include <catta/llist.h>
+#include <catta/malloc.h>
 
 #include "rrlist.h"
-#include <avahi/log.h>
+#include <catta/log.h>
 
-typedef struct AvahiRecordListItem AvahiRecordListItem;
+typedef struct CattaRecordListItem CattaRecordListItem;
 
-struct AvahiRecordListItem {
+struct CattaRecordListItem {
     int read;
-    AvahiRecord *record;
+    CattaRecord *record;
     int unicast_response;
     int flush_cache;
     int auxiliary;
-    AVAHI_LLIST_FIELDS(AvahiRecordListItem, items);
+    CATTA_LLIST_FIELDS(CattaRecordListItem, items);
 };
 
-struct AvahiRecordList {
-    AVAHI_LLIST_HEAD(AvahiRecordListItem, read);
-    AVAHI_LLIST_HEAD(AvahiRecordListItem, unread);
+struct CattaRecordList {
+    CATTA_LLIST_HEAD(CattaRecordListItem, read);
+    CATTA_LLIST_HEAD(CattaRecordListItem, unread);
 
     int all_flush_cache;
 };
 
-AvahiRecordList *avahi_record_list_new(void) {
-    AvahiRecordList *l;
+CattaRecordList *catta_record_list_new(void) {
+    CattaRecordList *l;
 
-    if (!(l = avahi_new(AvahiRecordList, 1))) {
-        avahi_log_error("avahi_new() failed.");
+    if (!(l = catta_new(CattaRecordList, 1))) {
+        catta_log_error("catta_new() failed.");
         return NULL;
     }
 
-    AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->read);
-    AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->unread);
+    CATTA_LLIST_HEAD_INIT(CattaRecordListItem, l->read);
+    CATTA_LLIST_HEAD_INIT(CattaRecordListItem, l->unread);
 
     l->all_flush_cache = 1;
     return l;
 }
 
-void avahi_record_list_free(AvahiRecordList *l) {
+void catta_record_list_free(CattaRecordList *l) {
     assert(l);
 
-    avahi_record_list_flush(l);
-    avahi_free(l);
+    catta_record_list_flush(l);
+    catta_free(l);
 }
 
-static void item_free(AvahiRecordList *l, AvahiRecordListItem *i) {
+static void item_free(CattaRecordList *l, CattaRecordListItem *i) {
     assert(l);
     assert(i);
 
     if (i->read)
-        AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->read, i);
+        CATTA_LLIST_REMOVE(CattaRecordListItem, items, l->read, i);
     else
-        AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i);
+        CATTA_LLIST_REMOVE(CattaRecordListItem, items, l->unread, i);
 
-    avahi_record_unref(i->record);
-    avahi_free(i);
+    catta_record_unref(i->record);
+    catta_free(i);
 }
 
-void avahi_record_list_flush(AvahiRecordList *l) {
+void catta_record_list_flush(CattaRecordList *l) {
     assert(l);
 
     while (l->read)
@@ -94,16 +94,16 @@ void avahi_record_list_flush(AvahiRecordList *l) {
     l->all_flush_cache = 1;
 }
 
-AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, int *ret_unicast_response, int *ret_auxiliary) {
-    AvahiRecord *r;
-    AvahiRecordListItem *i;
+CattaRecord* catta_record_list_next(CattaRecordList *l, int *ret_flush_cache, int *ret_unicast_response, int *ret_auxiliary) {
+    CattaRecord *r;
+    CattaRecordListItem *i;
 
     if (!(i = l->unread))
         return NULL;
 
     assert(!i->read);
 
-    r = avahi_record_ref(i->record);
+    r = catta_record_ref(i->record);
     if (ret_unicast_response)
         *ret_unicast_response = i->unicast_response;
     if (ret_flush_cache)
@@ -111,33 +111,33 @@ AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, in
     if (ret_auxiliary)
         *ret_auxiliary = i->auxiliary;
 
-    AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i);
-    AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->read, i);
+    CATTA_LLIST_REMOVE(CattaRecordListItem, items, l->unread, i);
+    CATTA_LLIST_PREPEND(CattaRecordListItem, items, l->read, i);
 
     i->read = 1;
 
     return r;
 }
 
-static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) {
-    AvahiRecordListItem *i;
+static CattaRecordListItem *get(CattaRecordList *l, CattaRecord *r) {
+    CattaRecordListItem *i;
 
     assert(l);
     assert(r);
 
     for (i = l->read; i; i = i->items_next)
-        if (avahi_record_equal_no_ttl(i->record, r))
+        if (catta_record_equal_no_ttl(i->record, r))
             return i;
 
     for (i = l->unread; i; i = i->items_next)
-        if (avahi_record_equal_no_ttl(i->record, r))
+        if (catta_record_equal_no_ttl(i->record, r))
             return i;
 
     return NULL;
 }
 
-void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, int unicast_response, int auxiliary) {
-    AvahiRecordListItem *i;
+void catta_record_list_push(CattaRecordList *l, CattaRecord *r, int flush_cache, int unicast_response, int auxiliary) {
+    CattaRecordListItem *i;
 
     assert(l);
     assert(r);
@@ -145,24 +145,24 @@ void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache,
     if (get(l, r))
         return;
 
-    if (!(i = avahi_new(AvahiRecordListItem, 1))) {
-        avahi_log_error("avahi_new() failed.");
+    if (!(i = catta_new(CattaRecordListItem, 1))) {
+        catta_log_error("catta_new() failed.");
         return;
     }
 
     i->unicast_response = unicast_response;
     i->flush_cache = flush_cache;
     i->auxiliary = auxiliary;
-    i->record = avahi_record_ref(r);
+    i->record = catta_record_ref(r);
     i->read = 0;
 
     l->all_flush_cache = l->all_flush_cache && flush_cache;
 
-    AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->unread, i);
+    CATTA_LLIST_PREPEND(CattaRecordListItem, items, l->unread, i);
 }
 
-void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r) {
-    AvahiRecordListItem *i;
+void catta_record_list_drop(CattaRecordList *l, CattaRecord *r) {
+    CattaRecordListItem *i;
 
     assert(l);
     assert(r);
@@ -173,13 +173,13 @@ void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r) {
     item_free(l, i);
 }
 
-int avahi_record_list_is_empty(AvahiRecordList *l) {
+int catta_record_list_is_empty(CattaRecordList *l) {
     assert(l);
 
     return !l->unread && !l->read;
 }
 
-int avahi_record_list_all_flush_cache(AvahiRecordList *l) {
+int catta_record_list_all_flush_cache(CattaRecordList *l) {
     assert(l);
 
     /* Return TRUE if all entries in this list have flush_cache set */