summaryrefslogtreecommitdiffstats
path: root/polyp/llist.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-08-14 20:25:32 +0000
committerLennart Poettering <lennart@poettering.net>2004-08-14 20:25:32 +0000
commit22cb23eedb2eae7c79dc8fcf395be08bfc666256 (patch)
treef0993d4a26cb6e311d052b40ac5b8efc1239c145 /polyp/llist.h
parent1c2ec47cf1506ad1c75c088d476ae382170df62c (diff)
implement proper refcounting in polyplib
split polyplib to multiple modules add some prelimenary documentation add doxygen support git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@123 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/llist.h')
-rw-r--r--polyp/llist.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/polyp/llist.h b/polyp/llist.h
new file mode 100644
index 00000000..1f145de2
--- /dev/null
+++ b/polyp/llist.h
@@ -0,0 +1,39 @@
+#ifndef foollistfoo
+#define foollistfoo
+
+#define PA_LLIST_HEAD(t,name) t *name
+
+#define PA_LLIST_FIELDS(t) t *next, *prev;
+
+#define PA_LLIST_HEAD_INIT(t,item) do { (item) = NULL; } while(0)
+
+#define PA_LLIST_INIT(t,item) do { \
+ t *_item = (item); \
+ assert(_item); \
+ _item->prev = _item->next = NULL; \
+ } while(0)
+
+#define PA_LLIST_PREPEND(t,head,item) do { \
+ t **_head = &(head), *_item = (item); \
+ assert(_item); \
+ if ((_item->next = *_head)) \
+ _item->next->prev = _item; \
+ _item->prev = NULL; \
+ *_head = _item; \
+ } while (0)
+
+#define PA_LLIST_REMOVE(t,head,item) do { \
+ t **_head = &(head), *_item = (item); \
+ assert(_item); \
+ if (_item->next) \
+ _item->next->prev = _item->prev; \
+ if (_item->prev) \
+ _item->prev->next = _item->next; \
+ else {\
+ assert(*_head == _item); \
+ *_head = _item->next; \
+ } \
+ _item->next = _item->prev = NULL; \
+ } while(0)
+
+#endif