/***
- 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 <stdio.h>
#include <assert.h>
-#include <avahi/gccmacro.h>
+#include <catta/gccmacro.h>
#include "../src/prioq.h"
return a < b ? -1 : (a > b ? 1 : 0);
}
-static void rec(AvahiPrioQueueNode *n) {
+static void rec(CattaPrioQueueNode *n) {
if (!n)
return;
rec(n->right);
}
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiPrioQueue *q, *q2;
+int main(CATTA_GCC_UNUSED int argc, CATTA_GCC_UNUSED char *argv[]) {
+ CattaPrioQueue *q, *q2;
int i;
- q = avahi_prio_queue_new(compare_int);
- q2 = avahi_prio_queue_new(compare_ptr);
+ q = catta_prio_queue_new(compare_int);
+ q2 = catta_prio_queue_new(compare_ptr);
srand(time(NULL));
for (i = 0; i < 10000; i++)
- avahi_prio_queue_put(q2, avahi_prio_queue_put(q, INT_TO_POINTER(random() & 0xFFFF)));
+ catta_prio_queue_put(q2, catta_prio_queue_put(q, INT_TO_POINTER(rand() & 0xFFFF)));
while (q2->root) {
rec(q->root);
assert(q->n_nodes == q2->n_nodes);
- printf("%i\n", POINTER_TO_INT(((AvahiPrioQueueNode*)q2->root->data)->data));
+ printf("%i\n", POINTER_TO_INT(((CattaPrioQueueNode*)q2->root->data)->data));
- avahi_prio_queue_remove(q, q2->root->data);
- avahi_prio_queue_remove(q2, q2->root);
+ catta_prio_queue_remove(q, q2->root->data);
+ catta_prio_queue_remove(q2, q2->root);
}
/* int v = GPOINTER_TO_INT(q->root->data); */
/* rec(q->root); */
/* printf("%i\n", v); */
-/* avahi_prio_queue_remove(q, q->root); */
+/* catta_prio_queue_remove(q, q->root); */
/* assert(v >= prev); */
/* prev = v; */
/* } */
- avahi_prio_queue_free(q);
+ catta_prio_queue_free(q);
return 0;
}