]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
LinkedList: delete method
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 5 Dec 2015 10:34:39 +0000 (21:34 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 5 Dec 2015 10:34:39 +0000 (21:34 +1100)
qcsrc/lib/linkedlist.qh

index 94d26e17575a55a921d32799f5dfe7a1b3650c65..a4200122f473452e3c76c4d9ca40c7d71e89c939 100644 (file)
@@ -45,6 +45,20 @@ entity LL_POP(LinkedList this)
        return e;
 }
 
+#define LL_DELETE(this) \
+       do \
+       { \
+               LinkedList _ll = this; \
+               assert(_ll); \
+               while (_ll.ll_tail) \
+               { \
+                       entity it = LL_POP(_ll); \
+                       if (it) remove(it); \
+               } \
+               this = NULL; \
+       } \
+       while (0)
+
 #define LL_EACH(list, cond, body) \
        do                                                                  \
        {                                                                   \