25 lines
623 B
C
25 lines
623 B
C
#ifndef LIST_H
|
|
#define LIST_H
|
|
|
|
void allocthings(void);
|
|
void *allocentry(void);
|
|
|
|
void _addtail(listhead *header, listhead *entry);
|
|
#define addtail(head, entry) _addtail(head, &(entry->list));
|
|
|
|
/* returns previous entry, use as
|
|
* iter = delinkhead(iter);
|
|
* in foreach_list_entry loops
|
|
*/
|
|
listhead* delinkhead(listhead *entry);
|
|
#define delink(entry) delinkhead(&(entry->list));
|
|
|
|
|
|
void initheader(listhead *head);
|
|
|
|
/* listhead *head, listhead *iter, XXX *item */
|
|
#define foreach_list_entry(head, iter, item) \
|
|
for (iter = (head)->next, item = (void*) iter; iter != (head); iter = iter->next, item = (void*) iter)
|
|
|
|
#endif
|