Select one of the symbols to view example projects that use it.
 
Outline
#define DL_LIST_H
#include <stddef.h>
dl_list
dl_list_init(struct dl_list *)
dl_list_add(struct dl_list *, struct dl_list *)
dl_list_add_tail(struct dl_list *, struct dl_list *)
dl_list_del(struct dl_list *)
dl_list_empty(struct dl_list *)
dl_list_len(struct dl_list *)
#define offsetof
Files
loading (2/5)...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/wpa_supplicant/src/utils/list.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * 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. *//* ... */ #ifndef DL_LIST_H #define DL_LIST_H #include <stddef.h> /** * struct dl_list - Doubly-linked list *//* ... */ struct dl_list { struct dl_list *next; struct dl_list *prev; }{ ... }; static inline void dl_list_init(struct dl_list *list) { list->next = list; list->prev = list; }{ ... } static inline void dl_list_add(struct dl_list *list, struct dl_list *item) { item->next = list->next; item->prev = list; list->next->prev = item; list->next = item; }{ ... } static inline void dl_list_add_tail(struct dl_list *list, struct dl_list *item) { dl_list_add(list->prev, item); }{ ... } static inline void dl_list_del(struct dl_list *item) { item->next->prev = item->prev; item->prev->next = item->next; item->next = NULL; item->prev = NULL; }{ ... } static inline int dl_list_empty(struct dl_list *list) { return list->next == list; }{ ... } static inline unsigned int dl_list_len(struct dl_list *list) { struct dl_list *item; int count = 0; for (item = list->next; item != list; item = item->next) count++; return count; }{ ... } #ifndef offsetof #define offsetof(type, member) ((long) &((type *) 0)->member) #endif #define dl_list_entry(item, type, member) \ ((type *) ((char *) item - offsetof(type, member)))... #define dl_list_first(list, type, member) \ (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); \ item = dl_list_entry(item->member.next, type, member))... #define dl_list_for_each_safe(item, n, list, type, member) \ for (item = dl_list_entry((list)->next, type, member), \ n = dl_list_entry(item->member.next, type, member); \ &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) }... 7 defines /* ... */#endif /* DL_LIST_H */
Details