summaryrefslogtreecommitdiff
path: root/test/list.h
diff options
context:
space:
mode:
authorJames Shaw <jshaw@netsurf-browser.org>2007-09-22 11:25:29 +0000
committerJames Shaw <jshaw@netsurf-browser.org>2007-09-22 11:25:29 +0000
commitd823bb50697d67e9b3f32603708fdd0299072c49 (patch)
tree85468d3bf6a1612290da905ae2c3be67f5167776 /test/list.h
parent99c0bb3943cd64518b977556e446720cad4ba6da (diff)
downloadlibdom-d823bb50697d67e9b3f32603708fdd0299072c49.tar.gz
libdom-d823bb50697d67e9b3f32603708fdd0299072c49.tar.bz2
Initial revision of linked list implementation
svn path=/trunk/dom/; revision=3559
Diffstat (limited to 'test/list.h')
-rw-r--r--test/list.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/list.h b/test/list.h
new file mode 100644
index 0000000..444f5c8
--- /dev/null
+++ b/test/list.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of libdom test suite.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 James Shaw <jshaw@netsurf-browser.org>
+ */
+
+#ifndef list_h_
+#define list_h_
+
+struct list_elt {
+ void* data;
+ struct list_elt* next;
+};
+
+struct list {
+ unsigned int size;
+ struct list_elt* head;
+ struct list_elt* tail;
+};
+
+struct list* list_new(void);
+void list_destroy(struct list* list);
+
+/**
+ * Add data to the tail of the list.
+ */
+void list_add(struct list* list, void* data);
+
+/**
+ * Tests if data is equal to any element in the list.
+ */
+bool list_contains(struct list* list, void* data, int (*comparator)(const void* a, const void* b));
+
+#endif