2 Copyright (C) 2010 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #define SLIST_ADD(list, item) \
20 (item)->next = (*list); \
24 #define SLIST_ADD_END(list, item) \
25 if ((*list) == NULL) { \
26 SLIST_ADD((list), (item)); \
28 void *head = (*list); \
29 while ((*list)->next) \
30 (*list) = (*list)->next; \
31 (*list)->next = (item); \
32 (item)->next = NULL; \
36 #define SLIST_REMOVE(list, item) \
37 if ((*list) == (item)) { \
38 (*list) = (item)->next; \
40 void *head = (*list); \
41 while ((*list)->next && (*list)->next != (item)) \
42 (*list) = (*list)->next; \
43 if ((*list)->next != NULL) { \
44 (*list)->next = (*list)->next->next; \