#ifndef LIST_H_INCLUDED
#define LIST_H_INCLUDED
#define INIT_LIST_HEAD(head) \
(head)->Flink = (head); \
(head)->Blink = (head)
#define UNLINK_ENTRY(entry) \
(entry)->Blink->Flink = (entry)->Flink; \
(entry)->Flink->Blink = (entry)->Blink
#define ADD_ENTRY(head,entry) \
(entry)->Flink=(head)->Flink; \
(entry)->Blink=(head); \
(head)->Flink->Blink = (entry); \
(head)->Flink = (entry)
#define ADD_ENTRY_TAIL(head,entry) \
(head)->Blink->Flink = (entry); \
(entry)->Blink = (head)->Blink; \
(entry)->Flink = (head); \
(head)->Blink = (entry)
#define get_list_entry(type,entry) (type)(entry)
#define list_for_each(pos, head) \
for (pos = (head)->Flink; pos!=(head); pos = (pos)->Flink)
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->Flink, n = pos->Flink; pos != (head);\
pos = n, n = (pos)->Flink)
#endif // LIST_H_INCLUDED
#define LIST_H_INCLUDED
#define INIT_LIST_HEAD(head) \
(head)->Flink = (head); \
(head)->Blink = (head)
#define UNLINK_ENTRY(entry) \
(entry)->Blink->Flink = (entry)->Flink; \
(entry)->Flink->Blink = (entry)->Blink
#define ADD_ENTRY(head,entry) \
(entry)->Flink=(head)->Flink; \
(entry)->Blink=(head); \
(head)->Flink->Blink = (entry); \
(head)->Flink = (entry)
#define ADD_ENTRY_TAIL(head,entry) \
(head)->Blink->Flink = (entry); \
(entry)->Blink = (head)->Blink; \
(entry)->Flink = (head); \
(head)->Blink = (entry)
#define get_list_entry(type,entry) (type)(entry)
#define list_for_each(pos, head) \
for (pos = (head)->Flink; pos!=(head); pos = (pos)->Flink)
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->Flink, n = pos->Flink; pos != (head);\
pos = n, n = (pos)->Flink)
#endif // LIST_H_INCLUDED
2 комментария:
А зачем?
Есть же в ddk соответствующие дефайны\функции, как-то InitializeListHead, RemoveEntryList, RemoveHeadList, InsertTailList, etc.
да есть, но меня чё-то переклинело свои сделать =)
Отправить комментарий