Release 20030408.
[wine/gsoc-2012-control.git] / dlls / imagehlp / internal.c
blob488a246f6c2ae531133bdcbe9b4045a40411ebee
1 /*
2 * IMAGEHLP library
4 * Copyright 1998 Patrik Stridvall
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "winbase.h"
22 #include "winerror.h"
23 #include "windef.h"
24 #include "wine/debug.h"
25 #include "imagehlp.h"
27 /***********************************************************************
28 * InitializeListHead
30 VOID InitializeListHead(PLIST_ENTRY pListHead)
32 pListHead->Flink = pListHead;
33 pListHead->Blink = pListHead;
36 /***********************************************************************
37 * InsertHeadList
39 VOID InsertHeadList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
41 pEntry->Blink = pListHead;
42 pEntry->Flink = pListHead->Flink;
43 pListHead->Flink = pEntry;
46 /***********************************************************************
47 * InsertTailList
49 VOID InsertTailList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
51 pEntry->Flink = pListHead;
52 pEntry->Blink = pListHead->Blink;
53 pListHead->Blink = pEntry;
56 /***********************************************************************
57 * IsListEmpty
59 BOOLEAN IsListEmpty(PLIST_ENTRY pListHead)
61 return !pListHead;
64 /***********************************************************************
65 * PopEntryList
67 PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY pListHead)
69 pListHead->Next = NULL;
70 return pListHead;
73 /***********************************************************************
74 * PushEntryList
76 VOID PushEntryList(
77 PSINGLE_LIST_ENTRY pListHead, PSINGLE_LIST_ENTRY pEntry)
79 pEntry->Next=pListHead;
82 /***********************************************************************
83 * RemoveEntryList
85 VOID RemoveEntryList(PLIST_ENTRY pEntry)
87 pEntry->Flink->Blink = pEntry->Blink;
88 pEntry->Blink->Flink = pEntry->Flink;
89 pEntry->Flink = NULL;
90 pEntry->Blink = NULL;
93 /***********************************************************************
94 * RemoveHeadList
96 PLIST_ENTRY RemoveHeadList(PLIST_ENTRY pListHead)
98 PLIST_ENTRY p = pListHead->Flink;
100 if(p != pListHead)
102 RemoveEntryList(pListHead);
103 return p;
105 else
107 pListHead->Flink = NULL;
108 pListHead->Blink = NULL;
109 return NULL;
113 /***********************************************************************
114 * RemoveTailList
116 PLIST_ENTRY RemoveTailList(PLIST_ENTRY pListHead)
118 RemoveHeadList(pListHead->Blink);
119 if(pListHead != pListHead->Blink)
120 return pListHead;
121 else
122 return NULL;