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
26 #include "wine/debug.h"
29 /***********************************************************************
32 VOID
InitializeListHead(PLIST_ENTRY pListHead
)
34 pListHead
->Flink
= pListHead
;
35 pListHead
->Blink
= pListHead
;
38 /***********************************************************************
41 VOID
InsertHeadList(PLIST_ENTRY pListHead
, PLIST_ENTRY pEntry
)
43 pEntry
->Blink
= pListHead
;
44 pEntry
->Flink
= pListHead
->Flink
;
45 pListHead
->Flink
= pEntry
;
48 /***********************************************************************
51 VOID
InsertTailList(PLIST_ENTRY pListHead
, PLIST_ENTRY pEntry
)
53 pEntry
->Flink
= pListHead
;
54 pEntry
->Blink
= pListHead
->Blink
;
55 pListHead
->Blink
= pEntry
;
58 /***********************************************************************
61 BOOLEAN
IsListEmpty(PLIST_ENTRY pListHead
)
66 /***********************************************************************
69 PSINGLE_LIST_ENTRY
PopEntryList(PSINGLE_LIST_ENTRY pListHead
)
71 pListHead
->Next
= NULL
;
75 /***********************************************************************
79 PSINGLE_LIST_ENTRY pListHead
, PSINGLE_LIST_ENTRY pEntry
)
81 pEntry
->Next
=pListHead
;
84 /***********************************************************************
87 VOID
RemoveEntryList(PLIST_ENTRY pEntry
)
89 pEntry
->Flink
->Blink
= pEntry
->Blink
;
90 pEntry
->Blink
->Flink
= pEntry
->Flink
;
95 /***********************************************************************
98 PLIST_ENTRY
RemoveHeadList(PLIST_ENTRY pListHead
)
100 PLIST_ENTRY p
= pListHead
->Flink
;
104 RemoveEntryList(pListHead
);
109 pListHead
->Flink
= NULL
;
110 pListHead
->Blink
= NULL
;
115 /***********************************************************************
118 PLIST_ENTRY
RemoveTailList(PLIST_ENTRY pListHead
)
120 RemoveHeadList(pListHead
->Blink
);
121 if(pListHead
!= pListHead
->Blink
)