4 * Copyright 1998 Patrik Stridvall
10 #include "debugtools.h"
13 /***********************************************************************
16 VOID
InitializeListHead(PLIST_ENTRY pListHead
)
18 pListHead
->Flink
= pListHead
;
19 pListHead
->Blink
= pListHead
;
22 /***********************************************************************
25 VOID
InsertHeadList(PLIST_ENTRY pListHead
, PLIST_ENTRY pEntry
)
27 pEntry
->Blink
= pListHead
;
28 pEntry
->Flink
= pListHead
->Flink
;
29 pListHead
->Flink
= pEntry
;
32 /***********************************************************************
35 VOID
InsertTailList(PLIST_ENTRY pListHead
, PLIST_ENTRY pEntry
)
37 pEntry
->Flink
= pListHead
;
38 pEntry
->Blink
= pListHead
->Blink
;
39 pListHead
->Blink
= pEntry
;
42 /***********************************************************************
45 BOOLEAN
IsListEmpty(PLIST_ENTRY pListHead
)
50 /***********************************************************************
53 PSINGLE_LIST_ENTRY
PopEntryList(PSINGLE_LIST_ENTRY pListHead
)
55 pListHead
->Next
= NULL
;
59 /***********************************************************************
63 PSINGLE_LIST_ENTRY pListHead
, PSINGLE_LIST_ENTRY pEntry
)
65 pEntry
->Next
=pListHead
;
68 /***********************************************************************
71 VOID
RemoveEntryList(PLIST_ENTRY pEntry
)
73 pEntry
->Flink
->Blink
= pEntry
->Blink
;
74 pEntry
->Blink
->Flink
= pEntry
->Flink
;
79 /***********************************************************************
82 PLIST_ENTRY
RemoveHeadList(PLIST_ENTRY pListHead
)
84 PLIST_ENTRY p
= pListHead
->Flink
;
88 RemoveEntryList(pListHead
);
93 pListHead
->Flink
= NULL
;
94 pListHead
->Blink
= NULL
;
99 /***********************************************************************
102 PLIST_ENTRY
RemoveTailList(PLIST_ENTRY pListHead
)
104 RemoveHeadList(pListHead
->Blink
);
105 if(pListHead
!= pListHead
->Blink
)