aboutsummaryrefslogtreecommitdiff
path: root/list.h
diff options
context:
space:
mode:
authorJavier S. Pedro <javier@javispedro.com>2013-01-06 02:04:56 +0100
committerJavier S. Pedro <javier@javispedro.com>2013-01-06 02:04:56 +0100
commit2f7314162c2a63a1015cc969bbe55319b3c99077 (patch)
tree5410d957743c6a4d6eb15a57bc961d815d690062 /list.h
parentdc5428be5c92f77a9bb8fb11d1a1b75cd44052d7 (diff)
downloadrodisc-client-win32-master.tar.gz
rodisc-client-win32-master.zip
initial importHEADmaster
Diffstat (limited to 'list.h')
-rw-r--r--list.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/list.h b/list.h
new file mode 100644
index 0000000..571b6d7
--- /dev/null
+++ b/list.h
@@ -0,0 +1,21 @@
+#ifndef LIST_H
+#define LIST_H
+
+#define list_add(Type, Head, Item) do {\
+ Item->next = Head; \
+ Head = Item; \
+ } while (0);
+
+#define list_remove(Type, Head, Item) do {\
+ Type **p; \
+ for (p = &Head; *p; p = &((*p)->next)) { \
+ if (*p = Item) { \
+ *p = Item->next; \
+ } \
+ } \
+ } while (0);
+
+#define list_foreach(Type, Head, Item) \
+ for (Item = Head; Item; Item = Item->next)
+
+#endif \ No newline at end of file