Created
July 18, 2019 12:40
-
-
Save ek0/71d5c79e16cd3e157870a1e62d0c3801 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void InitializeListHead(LIST_ENTRY* list_head) | |
{ | |
list_head->Flink = list_head; | |
list_head->Blink = list_head; | |
} | |
inline int IsListEmpty(LIST_ENTRY* list_head) | |
{ | |
return list_head->Flink == list_head; | |
} | |
inline void InsertHeadList(LIST_ENTRY* list_head, LIST_ENTRY* entry) | |
{ | |
LIST_ENTRY* next; | |
next = list_head->Flink; | |
entry->Flink = next; | |
entry->Blink = list_head; | |
next->Blink = entry; | |
list_head->Flink = entry; | |
} | |
inline void InsertTailList(LIST_ENTRY* list_head, LIST_ENTRY* entry) | |
{ | |
LIST_ENTRY* prev; | |
prev = list_head->Blink; | |
entry->Flink = list_head; | |
entry->Blink = prev; | |
prev->Flink = entry; | |
list_head->Blink = entry; | |
} | |
inline void RemoveEntryList(LIST_ENTRY* entry) | |
{ | |
LIST_ENTRY* prev; | |
LIST_ENTRY* next; | |
prev = entry->Blink; | |
next = entry->Flink; | |
prev->Flink = next; | |
next->Blink = prev; | |
} | |
inline LIST_ENTRY* RemoveHeadList(LIST_ENTRY* list_head) | |
{ | |
LIST_ENTRY* entry; | |
entry = list_head->Flink; | |
RemoveEntryList(entry); | |
return entry; | |
} | |
inline LIST_ENTRY* RemoveTailList(LIST_ENTRY* list_head) | |
{ | |
LIST_ENTRY* entry; | |
entry = list_head->Blink; | |
RemoveEntryList(entry); | |
return entry; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment