- fixed reported bugs
[wine.git] / dlls / imagehlp / internal.c
blob60049a7e6a67c6fdb375f034ebb7ea30ffd313a6
1 /*
2 * IMAGEHLP library
4 * Copyright 1998 Patrik Stridvall
5 */
7 #include "winbase.h"
8 #include "winerror.h"
9 #include "windef.h"
10 #include "debugtools.h"
11 #include "imagehlp.h"
13 /***********************************************************************
14 * InitializeListHead
16 VOID InitializeListHead(PLIST_ENTRY pListHead)
18 pListHead->Flink = pListHead;
19 pListHead->Blink = pListHead;
22 /***********************************************************************
23 * InsertHeadList
25 VOID InsertHeadList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
27 pEntry->Blink = pListHead;
28 pEntry->Flink = pListHead->Flink;
29 pListHead->Flink = pEntry;
32 /***********************************************************************
33 * InsertTailList
35 VOID InsertTailList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
37 pEntry->Flink = pListHead;
38 pEntry->Blink = pListHead->Blink;
39 pListHead->Blink = pEntry;
42 /***********************************************************************
43 * IsListEmpty
45 BOOLEAN IsListEmpty(PLIST_ENTRY pListHead)
47 return !pListHead;
50 /***********************************************************************
51 * PopEntryList
53 PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY pListHead)
55 pListHead->Next = NULL;
56 return pListHead;
59 /***********************************************************************
60 * PushEntryList
62 VOID PushEntryList(
63 PSINGLE_LIST_ENTRY pListHead, PSINGLE_LIST_ENTRY pEntry)
65 pEntry->Next=pListHead;
68 /***********************************************************************
69 * RemoveEntryList
71 VOID RemoveEntryList(PLIST_ENTRY pEntry)
73 pEntry->Flink->Blink = pEntry->Blink;
74 pEntry->Blink->Flink = pEntry->Flink;
75 pEntry->Flink = NULL;
76 pEntry->Blink = NULL;
79 /***********************************************************************
80 * RemoveHeadList
82 PLIST_ENTRY RemoveHeadList(PLIST_ENTRY pListHead)
84 PLIST_ENTRY p = pListHead->Flink;
86 if(p != pListHead)
88 RemoveEntryList(pListHead);
89 return p;
91 else
93 pListHead->Flink = NULL;
94 pListHead->Blink = NULL;
95 return NULL;
99 /***********************************************************************
100 * RemoveTailList
102 PLIST_ENTRY RemoveTailList(PLIST_ENTRY pListHead)
104 RemoveHeadList(pListHead->Blink);
105 if(pListHead != pListHead->Blink)
106 return pListHead;
107 else
108 return NULL;