]>
code.delx.au - pulseaudio/blob - polyp/llist.h
ec8e029974926b96a30bb533a9f7dd773d4da63c
7 This file is part of polypaudio.
9 polypaudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 2 of the License,
12 or (at your option) any later version.
14 polypaudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with polypaudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #define PA_LLIST_HEAD(t,name) t *name
27 #define PA_LLIST_FIELDS(t) t *next, *prev
29 #define PA_LLIST_HEAD_INIT(t,item) do { (item) = NULL; } while(0)
31 #define PA_LLIST_INIT(t,item) do { \
34 _item->prev = _item->next = NULL; \
37 #define PA_LLIST_PREPEND(t,head,item) do { \
38 t **_head = &(head), *_item = (item); \
40 if ((_item->next = *_head)) \
41 _item->next->prev = _item; \
46 #define PA_LLIST_REMOVE(t,head,item) do { \
47 t **_head = &(head), *_item = (item); \
50 _item->next->prev = _item->prev; \
52 _item->prev->next = _item->next; \
54 assert(*_head == _item); \
55 *_head = _item->next; \
57 _item->next = _item->prev = NULL; \