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
24 #include "wine/debug.h"
27 /***********************************************************************
30 VOID
InitializeListHead(PLIST_ENTRY pListHead
)
32 pListHead
->Flink
= pListHead
;
33 pListHead
->Blink
= pListHead
;
36 /***********************************************************************
39 VOID
InsertHeadList(PLIST_ENTRY pListHead
, PLIST_ENTRY pEntry
)
41 pEntry
->Blink
= pListHead
;
42 pEntry
->Flink
= pListHead
->Flink
;
43 pListHead
->Flink
= pEntry
;
46 /***********************************************************************
49 VOID
InsertTailList(PLIST_ENTRY pListHead
, PLIST_ENTRY pEntry
)
51 pEntry
->Flink
= pListHead
;
52 pEntry
->Blink
= pListHead
->Blink
;
53 pListHead
->Blink
= pEntry
;
56 /***********************************************************************
59 BOOLEAN
IsListEmpty(PLIST_ENTRY pListHead
)
64 /***********************************************************************
67 PSINGLE_LIST_ENTRY
PopEntryList(PSINGLE_LIST_ENTRY pListHead
)
69 pListHead
->Next
= NULL
;
73 /***********************************************************************
77 PSINGLE_LIST_ENTRY pListHead
, PSINGLE_LIST_ENTRY pEntry
)
79 pEntry
->Next
=pListHead
;
82 /***********************************************************************
85 VOID
RemoveEntryList(PLIST_ENTRY pEntry
)
87 pEntry
->Flink
->Blink
= pEntry
->Blink
;
88 pEntry
->Blink
->Flink
= pEntry
->Flink
;
93 /***********************************************************************
96 PLIST_ENTRY
RemoveHeadList(PLIST_ENTRY pListHead
)
98 PLIST_ENTRY p
= pListHead
->Flink
;
102 RemoveEntryList(pListHead
);
107 pListHead
->Flink
= NULL
;
108 pListHead
->Blink
= NULL
;
113 /***********************************************************************
116 PLIST_ENTRY
RemoveTailList(PLIST_ENTRY pListHead
)
118 RemoveHeadList(pListHead
->Blink
);
119 if(pListHead
!= pListHead
->Blink
)