From: TimePath Date: Sat, 5 Dec 2015 10:34:39 +0000 (+1100) Subject: LinkedList: delete method X-Git-Tag: xonotic-v0.8.2~1548 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5180d45c194e9b05a10713846731a312376a3bef;p=xonotic%2Fxonotic-data.pk3dir.git LinkedList: delete method --- diff --git a/qcsrc/lib/linkedlist.qh b/qcsrc/lib/linkedlist.qh index 94d26e175..a4200122f 100644 --- a/qcsrc/lib/linkedlist.qh +++ b/qcsrc/lib/linkedlist.qh @@ -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 \ { \