diff options
Diffstat (limited to 'contrib/wpa/src/utils/list.h')
-rw-r--r-- | contrib/wpa/src/utils/list.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/contrib/wpa/src/utils/list.h b/contrib/wpa/src/utils/list.h index ed7c022..6881130 100644 --- a/contrib/wpa/src/utils/list.h +++ b/contrib/wpa/src/utils/list.h @@ -2,14 +2,8 @@ * Doubly-linked list * Copyright (c) 2009, Jouni Malinen <j@w1.fi> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. + * This software may be distributed under the terms of the BSD license. + * See README for more details. */ #ifndef LIST_H @@ -75,6 +69,10 @@ static inline unsigned int dl_list_len(struct dl_list *list) (dl_list_empty((list)) ? NULL : \ dl_list_entry((list)->next, type, member)) +#define dl_list_last(list, type, member) \ + (dl_list_empty((list)) ? NULL : \ + dl_list_entry((list)->prev, type, member)) + #define dl_list_for_each(item, list, type, member) \ for (item = dl_list_entry((list)->next, type, member); \ &item->member != (list); \ @@ -86,4 +84,12 @@ static inline unsigned int dl_list_len(struct dl_list *list) &item->member != (list); \ item = n, n = dl_list_entry(n->member.next, type, member)) +#define dl_list_for_each_reverse(item, list, type, member) \ + for (item = dl_list_entry((list)->prev, type, member); \ + &item->member != (list); \ + item = dl_list_entry(item->member.prev, type, member)) + +#define DEFINE_DL_LIST(name) \ + struct dl_list name = { &(name), &(name) } + #endif /* LIST_H */ |