sdlbomber/list.h

27 lines
810 B
C
Raw Normal View History

#ifndef LIST_H
#define LIST_H
void allocthings(void);
void *allocentry(void);
2009-08-11 15:19:43 +00:00
void _addtail(listhead *header, listhead *entry);
#define addtail(head, entry) _addtail(head, &(entry->list));
2009-08-11 15:46:32 +00:00
/* returns previous entry */
2009-08-11 15:19:43 +00:00
listhead* delinkhead(listhead *entry);
#define delink(entry) delinkhead(&(entry->list));
void initheader(listhead *head);
2009-08-11 15:46:32 +00:00
/* listhead *head, XXX *item */
#define foreach_list_fast(head, item) \
for (item = (void*) (head)->next; (listhead*) item != (head); item = (void*) ((listhead*)item)->next)
/* listhead *head, XXX *item, XXX *next : you are allowed to delink(item) */
#define foreach_list_safe(head, item, next) \
for (item = (void*) (head)->next, next = (void*) ((listhead*)item)->next; (listhead*) item != (head); item = next, next = (void*) ((listhead*)item)->next)
#endif