ustream: properly clear fields to fix ustream reuse
[project/libubox.git] / list_compat.h
1 /*
2  * Copyright (C) 2011-2013 Felix Fietkau <nbd@openwrt.org>
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef __LIST_COMPAT_H
18 #define __LIST_COMPAT_H
19
20 #define list_entity                             list_head
21
22 #define list_init_head(_list)                   INIT_LIST_HEAD(_list)
23 #define list_add_head(_head, _list)             list_add(_list, _head)
24 #define list_add_after(_after, _list)           list_add(_list, _after)
25 #define list_add_before(_before, _list)         list_add_tail(_list, _before)
26 #define list_remove(_list)                      list_del(_list)
27 #define list_is_empty(_list)                    list_empty(_list)
28 #define list_next_element(_element, _member)    list_entry((_element)->_member.next, typeof(*(_element)), _member)
29
30
31 #endif