mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Make InitializeListHead, InsertHeadList, InsertTailList and
RemoveEntryList an inline functions instead of macros to match DDK. It's important because using macros can lead to variable name conflicts. - Make PopEntryList, PushEntryList a macro instead of inline function (to match DDK). - RemoveEntryList, RemoveHeadList and RemoveTailList shouldn't zero Blink and Flink of the removed entry. The MS documentation is wrong and there has been already submitted an official bug report for that. svn path=/trunk/; revision=11478
This commit is contained in:
parent
f9f887791c
commit
0ca74773d6
6 changed files with 142 additions and 252 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: rtl.h,v 1.37 2004/10/24 20:37:25 weiden Exp $
|
/* $Id: rtl.h,v 1.38 2004/10/30 14:02:01 navaraf Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef __DDK_RTL_H
|
#ifndef __DDK_RTL_H
|
||||||
|
@ -88,10 +88,11 @@
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
* ListHead = Caller supplied storage for the head of the list
|
* ListHead = Caller supplied storage for the head of the list
|
||||||
*/
|
*/
|
||||||
#define InitializeListHead(ListHead) \
|
static __inline VOID
|
||||||
{ \
|
InitializeListHead(
|
||||||
(ListHead)->Flink = (ListHead); \
|
IN PLIST_ENTRY ListHead)
|
||||||
(ListHead)->Blink = (ListHead); \
|
{
|
||||||
|
ListHead->Flink = ListHead->Blink = ListHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,19 +108,17 @@
|
||||||
* ListHead = Head of the list
|
* ListHead = Head of the list
|
||||||
* Entry = Entry to insert
|
* Entry = Entry to insert
|
||||||
*/
|
*/
|
||||||
#define InsertHeadList(ListHead, ListEntry) \
|
static __inline VOID
|
||||||
{ \
|
InsertHeadList(
|
||||||
PLIST_ENTRY OldFlink; \
|
IN PLIST_ENTRY ListHead,
|
||||||
OldFlink = (ListHead)->Flink; \
|
IN PLIST_ENTRY Entry)
|
||||||
(ListEntry)->Flink = OldFlink; \
|
{
|
||||||
(ListEntry)->Blink = (ListHead); \
|
PLIST_ENTRY OldFlink;
|
||||||
OldFlink->Blink = (ListEntry); \
|
OldFlink = ListHead->Flink;
|
||||||
(ListHead)->Flink = (ListEntry); \
|
Entry->Flink = OldFlink;
|
||||||
ASSERT((ListEntry) != NULL); \
|
Entry->Blink = ListHead;
|
||||||
ASSERT((ListEntry)->Blink!=NULL); \
|
OldFlink->Blink = Entry;
|
||||||
ASSERT((ListEntry)->Blink->Flink == (ListEntry)); \
|
ListHead->Flink = Entry;
|
||||||
ASSERT((ListEntry)->Flink != NULL); \
|
|
||||||
ASSERT((ListEntry)->Flink->Blink == (ListEntry)); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,14 +136,17 @@
|
||||||
* ListHead = Head of the list
|
* ListHead = Head of the list
|
||||||
* Entry = Entry to insert
|
* Entry = Entry to insert
|
||||||
*/
|
*/
|
||||||
#define InsertTailList(ListHead, ListEntry) \
|
static __inline VOID
|
||||||
{ \
|
InsertTailList(
|
||||||
PLIST_ENTRY OldBlink; \
|
IN PLIST_ENTRY ListHead,
|
||||||
OldBlink = (ListHead)->Blink; \
|
IN PLIST_ENTRY Entry)
|
||||||
(ListEntry)->Flink = (ListHead); \
|
{
|
||||||
(ListEntry)->Blink = OldBlink; \
|
PLIST_ENTRY OldBlink;
|
||||||
OldBlink->Flink = (ListEntry); \
|
OldBlink = ListHead->Blink;
|
||||||
(ListHead)->Blink = (ListEntry); \
|
Entry->Flink = ListHead;
|
||||||
|
Entry->Blink = OldBlink;
|
||||||
|
OldBlink->Flink = Entry;
|
||||||
|
ListHead->Blink = Entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -178,49 +180,24 @@
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* The removed entry
|
* The removed entry
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
#define PopEntryList(ListHead) \
|
#define PopEntryList(ListHead) \
|
||||||
(ListHead)->Next; \
|
(ListHead)->Next; \
|
||||||
{ \
|
{ \
|
||||||
PSINGLE_LIST_ENTRY FirstEntry; \
|
PSINGLE_LIST_ENTRY _FirstEntry; \
|
||||||
FirstEntry = (ListHead)->Next; \
|
_FirstEntry = (ListHead)->Next; \
|
||||||
if (FirstEntry != NULL) \
|
if (_FirstEntry != NULL) \
|
||||||
{ \
|
(ListHead)->Next = _FirstEntry->Next; \
|
||||||
(ListHead)->Next = FirstEntry->Next; \
|
|
||||||
} \
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
static inline PSINGLE_LIST_ENTRY
|
|
||||||
PopEntryList(PSINGLE_LIST_ENTRY ListHead)
|
|
||||||
{
|
|
||||||
PSINGLE_LIST_ENTRY ListEntry;
|
|
||||||
|
|
||||||
ListEntry = ListHead->Next;
|
|
||||||
if (ListEntry!=NULL)
|
|
||||||
{
|
|
||||||
ListHead->Next = ListEntry->Next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ListEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define RtlCopyMemory(Destination,Source,Length) \
|
#define RtlCopyMemory(Destination,Source,Length) \
|
||||||
memcpy((Destination),(Source),(Length))
|
memcpy((Destination),(Source),(Length))
|
||||||
|
|
||||||
static
|
#define PushEntryList(_ListHead, _Entry) \
|
||||||
inline
|
(_Entry)->Next = (_ListHead)->Next; \
|
||||||
VOID
|
(_ListHead)->Next = (_Entry); \
|
||||||
PushEntryList (
|
|
||||||
PSINGLE_LIST_ENTRY ListHead,
|
|
||||||
PSINGLE_LIST_ENTRY Entry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Entry->Next = ListHead->Next;
|
|
||||||
ListHead->Next = Entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*VOID
|
*BOOLEAN
|
||||||
*RemoveEntryList (
|
*RemoveEntryList (
|
||||||
* PLIST_ENTRY Entry
|
* PLIST_ENTRY Entry
|
||||||
* );
|
* );
|
||||||
|
@ -231,21 +208,18 @@ PushEntryList (
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
* ListEntry = Entry to remove
|
* ListEntry = Entry to remove
|
||||||
*/
|
*/
|
||||||
#define RemoveEntryList(ListEntry) \
|
static __inline BOOLEAN
|
||||||
{ \
|
RemoveEntryList(
|
||||||
PLIST_ENTRY OldFlink; \
|
IN PLIST_ENTRY Entry)
|
||||||
PLIST_ENTRY OldBlink; \
|
{
|
||||||
ASSERT((ListEntry) != NULL); \
|
PLIST_ENTRY OldFlink;
|
||||||
ASSERT((ListEntry)->Blink!=NULL); \
|
PLIST_ENTRY OldBlink;
|
||||||
ASSERT((ListEntry)->Blink->Flink == (ListEntry)); \
|
|
||||||
ASSERT((ListEntry)->Flink != NULL); \
|
OldFlink = Entry->Flink;
|
||||||
ASSERT((ListEntry)->Flink->Blink == (ListEntry)); \
|
OldBlink = Entry->Blink;
|
||||||
OldFlink = (ListEntry)->Flink; \
|
OldFlink->Blink = OldBlink;
|
||||||
OldBlink = (ListEntry)->Blink; \
|
OldBlink->Flink = OldFlink;
|
||||||
OldFlink->Blink = OldBlink; \
|
return (OldFlink == OldBlink);
|
||||||
OldBlink->Flink = OldFlink; \
|
|
||||||
(ListEntry)->Flink = NULL; \
|
|
||||||
(ListEntry)->Blink = NULL; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,42 +238,18 @@ PushEntryList (
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* The removed entry
|
* The removed entry
|
||||||
*/
|
*/
|
||||||
/*
|
static __inline PLIST_ENTRY
|
||||||
#define RemoveHeadList(ListHead) \
|
RemoveHeadList(
|
||||||
(ListHead)->Flink; \
|
IN PLIST_ENTRY ListHead)
|
||||||
{RemoveEntryList((ListHead)->Flink)}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
PLIST_ENTRY
|
|
||||||
RemoveHeadList (
|
|
||||||
PLIST_ENTRY ListHead
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
static
|
|
||||||
inline
|
|
||||||
PLIST_ENTRY
|
|
||||||
RemoveHeadList (
|
|
||||||
PLIST_ENTRY ListHead
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Old;
|
PLIST_ENTRY Flink;
|
||||||
PLIST_ENTRY OldFlink;
|
PLIST_ENTRY Entry;
|
||||||
PLIST_ENTRY OldBlink;
|
|
||||||
|
|
||||||
Old = ListHead->Flink;
|
Entry = ListHead->Flink;
|
||||||
|
Flink = Entry->Flink;
|
||||||
OldFlink = ListHead->Flink->Flink;
|
ListHead->Flink = Flink;
|
||||||
OldBlink = ListHead->Flink->Blink;
|
Flink->Blink = ListHead;
|
||||||
OldFlink->Blink = OldBlink;
|
return Entry;
|
||||||
OldBlink->Flink = OldFlink;
|
|
||||||
if (Old != ListHead)
|
|
||||||
{
|
|
||||||
Old->Flink = NULL;
|
|
||||||
Old->Blink = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(Old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -318,42 +268,18 @@ RemoveHeadList (
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* The removed entry
|
* The removed entry
|
||||||
*/
|
*/
|
||||||
/*
|
static __inline PLIST_ENTRY
|
||||||
#define RemoveTailList(ListHead) \
|
RemoveTailList(
|
||||||
(ListHead)->Blink; \
|
IN PLIST_ENTRY ListHead)
|
||||||
{RemoveEntryList((ListHead)->Blink)}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
PLIST_ENTRY
|
|
||||||
RemoveTailList (
|
|
||||||
PLIST_ENTRY ListHead
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
static
|
|
||||||
inline
|
|
||||||
PLIST_ENTRY
|
|
||||||
RemoveTailList (
|
|
||||||
PLIST_ENTRY ListHead
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Old;
|
PLIST_ENTRY Blink;
|
||||||
PLIST_ENTRY OldFlink;
|
PLIST_ENTRY Entry;
|
||||||
PLIST_ENTRY OldBlink;
|
|
||||||
|
|
||||||
Old = ListHead->Blink;
|
Entry = ListHead->Blink;
|
||||||
|
Blink = Entry->Blink;
|
||||||
OldFlink = ListHead->Blink->Flink;
|
ListHead->Blink = Blink;
|
||||||
OldBlink = ListHead->Blink->Blink;
|
Blink->Flink = ListHead;
|
||||||
OldFlink->Blink = OldBlink;
|
return Entry;
|
||||||
OldBlink->Flink = OldFlink;
|
|
||||||
if (Old != ListHead)
|
|
||||||
{
|
|
||||||
Old->Flink = NULL;
|
|
||||||
Old->Blink = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(Old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: utils.c,v 1.99 2004/07/14 02:40:45 navaraf Exp $
|
/* $Id: utils.c,v 1.100 2004/10/30 14:02:03 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -2415,7 +2415,7 @@ LdrpDetachProcess(BOOL UnloadAll)
|
||||||
((UnloadAll && Module->LoadCount >= 0) || Module->LoadCount == 0))
|
((UnloadAll && Module->LoadCount >= 0) || Module->LoadCount == 0))
|
||||||
{
|
{
|
||||||
/* remove the module entry from the list */
|
/* remove the module entry from the list */
|
||||||
RemoveEntryList (&Module->InLoadOrderModuleList)
|
RemoveEntryList (&Module->InLoadOrderModuleList);
|
||||||
RemoveEntryList (&Module->InInitializationOrderModuleList);
|
RemoveEntryList (&Module->InInitializationOrderModuleList);
|
||||||
|
|
||||||
NtUnmapViewOfSection (NtCurrentProcess (), Module->BaseAddress);
|
NtUnmapViewOfSection (NtCurrentProcess (), Module->BaseAddress);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: atom.c,v 1.6 2004/05/13 20:48:31 navaraf Exp $
|
/* $Id: atom.c,v 1.7 2004/10/30 14:02:04 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -285,7 +285,7 @@ RtlAddAtomToAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertTailList(&AtomTable->Slot[Hash], &Entry->List)
|
InsertTailList(&AtomTable->Slot[Hash], &Entry->List);
|
||||||
RtlCreateUnicodeString (&Entry->Name,
|
RtlCreateUnicodeString (&Entry->Name,
|
||||||
AtomName);
|
AtomName);
|
||||||
Entry->RefCount = 1;
|
Entry->RefCount = 1;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: callback.c,v 1.12 2004/08/15 16:39:01 chorns Exp $
|
/* $Id: callback.c,v 1.13 2004/10/30 14:02:04 navaraf Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ex/callback.c
|
* FILE: ntoskrnl/ex/callback.c
|
||||||
|
@ -391,7 +391,7 @@ ExRegisterCallback(
|
||||||
/* Add Callback if 1) No Callbacks registered or 2) Multiple Callbacks allowed */
|
/* Add Callback if 1) No Callbacks registered or 2) Multiple Callbacks allowed */
|
||||||
if(CallbackObject->AllowMultipleCallbacks || IsListEmpty(&CallbackObject->RegisteredCallbacks))
|
if(CallbackObject->AllowMultipleCallbacks || IsListEmpty(&CallbackObject->RegisteredCallbacks))
|
||||||
{
|
{
|
||||||
InsertTailList(&CallbackObject->RegisteredCallbacks,&CallbackRegistration->RegisteredCallbacks)
|
InsertTailList(&CallbackObject->RegisteredCallbacks,&CallbackRegistration->RegisteredCallbacks);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: atom.c,v 1.11 2004/08/15 16:39:11 chorns Exp $
|
/* $Id: atom.c,v 1.12 2004/10/30 14:02:04 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -377,7 +377,7 @@ RtlAddAtomToAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertTailList(&AtomTable->Slot[Hash], &Entry->List)
|
InsertTailList(&AtomTable->Slot[Hash], &Entry->List);
|
||||||
RtlCreateUnicodeString (&Entry->Name,
|
RtlCreateUnicodeString (&Entry->Name,
|
||||||
AtomName);
|
AtomName);
|
||||||
Entry->RefCount = 1;
|
Entry->RefCount = 1;
|
||||||
|
|
|
@ -4161,49 +4161,37 @@ RtlAssert(
|
||||||
|
|
||||||
/** Runtime library routines **/
|
/** Runtime library routines **/
|
||||||
|
|
||||||
/*
|
static __inline VOID
|
||||||
* VOID
|
InitializeListHead(
|
||||||
* InitializeListHead(
|
IN PLIST_ENTRY ListHead)
|
||||||
* IN PLIST_ENTRY ListHead)
|
{
|
||||||
*/
|
ListHead->Flink = ListHead->Blink = ListHead;
|
||||||
#define InitializeListHead(_ListHead) \
|
|
||||||
{ \
|
|
||||||
(_ListHead)->Flink = (_ListHead); \
|
|
||||||
(_ListHead)->Blink = (_ListHead); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static __inline VOID
|
||||||
* VOID
|
InsertHeadList(
|
||||||
* InsertHeadList(
|
IN PLIST_ENTRY ListHead,
|
||||||
* IN PLIST_ENTRY ListHead,
|
IN PLIST_ENTRY Entry)
|
||||||
* IN PLIST_ENTRY Entry)
|
{
|
||||||
*/
|
PLIST_ENTRY OldFlink;
|
||||||
#define InsertHeadList(_ListHead, \
|
OldFlink = ListHead->Flink;
|
||||||
_Entry) \
|
Entry->Flink = OldFlink;
|
||||||
{ \
|
Entry->Blink = ListHead;
|
||||||
PLIST_ENTRY _OldFlink; \
|
OldFlink->Blink = Entry;
|
||||||
_OldFlink = (_ListHead)->Flink; \
|
ListHead->Flink = Entry;
|
||||||
(_Entry)->Flink = _OldFlink; \
|
|
||||||
(_Entry)->Blink = (_ListHead); \
|
|
||||||
_OldFlink->Blink = (_Entry); \
|
|
||||||
(_ListHead)->Flink = (_Entry); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static __inline VOID
|
||||||
* VOID
|
InsertTailList(
|
||||||
* InsertTailList(
|
IN PLIST_ENTRY ListHead,
|
||||||
* IN PLIST_ENTRY ListHead,
|
IN PLIST_ENTRY Entry)
|
||||||
* IN PLIST_ENTRY Entry)
|
{
|
||||||
*/
|
PLIST_ENTRY OldBlink;
|
||||||
#define InsertTailList(_ListHead, \
|
OldBlink = ListHead->Blink;
|
||||||
_Entry) \
|
Entry->Flink = ListHead;
|
||||||
{ \
|
Entry->Blink = OldBlink;
|
||||||
PLIST_ENTRY _OldBlink; \
|
OldBlink->Flink = Entry;
|
||||||
_OldBlink = (_ListHead)->Blink; \
|
ListHead->Blink = Entry;
|
||||||
(_Entry)->Flink = (_ListHead); \
|
|
||||||
(_Entry)->Blink = _OldBlink; \
|
|
||||||
_OldBlink->Flink = (_Entry); \
|
|
||||||
(_ListHead)->Blink = (_Entry); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4214,19 +4202,19 @@ RtlAssert(
|
||||||
#define IsListEmpty(_ListHead) \
|
#define IsListEmpty(_ListHead) \
|
||||||
((_ListHead)->Flink == (_ListHead))
|
((_ListHead)->Flink == (_ListHead))
|
||||||
|
|
||||||
static __inline PSINGLE_LIST_ENTRY
|
/*
|
||||||
PopEntryList(
|
* PSINGLE_LIST_ENTRY
|
||||||
IN PSINGLE_LIST_ENTRY ListHead)
|
* PopEntryList(
|
||||||
{
|
* IN PSINGLE_LIST_ENTRY ListHead)
|
||||||
PSINGLE_LIST_ENTRY Entry;
|
*/
|
||||||
|
#define PopEntryList(ListHead) \
|
||||||
Entry = ListHead->Next;
|
(ListHead)->Next; \
|
||||||
if (Entry != NULL)
|
{ \
|
||||||
{
|
PSINGLE_LIST_ENTRY _FirstEntry; \
|
||||||
ListHead->Next = Entry->Next;
|
_FirstEntry = (ListHead)->Next; \
|
||||||
}
|
if (_FirstEntry != NULL) \
|
||||||
return Entry;
|
(ListHead)->Next = _FirstEntry->Next; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VOID
|
* VOID
|
||||||
|
@ -4234,73 +4222,49 @@ PopEntryList(
|
||||||
* IN PSINGLE_LIST_ENTRY ListHead,
|
* IN PSINGLE_LIST_ENTRY ListHead,
|
||||||
* IN PSINGLE_LIST_ENTRY Entry)
|
* IN PSINGLE_LIST_ENTRY Entry)
|
||||||
*/
|
*/
|
||||||
#define PushEntryList(_ListHead, \
|
#define PushEntryList(_ListHead, _Entry) \
|
||||||
_Entry) \
|
|
||||||
{ \
|
|
||||||
(_Entry)->Next = (_ListHead)->Next; \
|
(_Entry)->Next = (_ListHead)->Next; \
|
||||||
(_ListHead)->Next = (_Entry); \
|
(_ListHead)->Next = (_Entry); \
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
static __inline BOOLEAN
|
||||||
* VOID
|
RemoveEntryList(
|
||||||
* RemoveEntryList(
|
IN PLIST_ENTRY Entry)
|
||||||
* IN PLIST_ENTRY Entry)
|
{
|
||||||
*/
|
PLIST_ENTRY OldFlink;
|
||||||
#define RemoveEntryList(_Entry) \
|
PLIST_ENTRY OldBlink;
|
||||||
{ \
|
|
||||||
PLIST_ENTRY _OldFlink; \
|
OldFlink = Entry->Flink;
|
||||||
PLIST_ENTRY _OldBlink; \
|
OldBlink = Entry->Blink;
|
||||||
_OldFlink = (_Entry)->Flink; \
|
OldFlink->Blink = OldBlink;
|
||||||
_OldBlink = (_Entry)->Blink; \
|
OldBlink->Flink = OldFlink;
|
||||||
_OldFlink->Blink = _OldBlink; \
|
return (OldFlink == OldBlink);
|
||||||
_OldBlink->Flink = _OldFlink; \
|
|
||||||
(_Entry)->Flink = NULL; \
|
|
||||||
(_Entry)->Blink = NULL; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline PLIST_ENTRY
|
static __inline PLIST_ENTRY
|
||||||
RemoveHeadList(
|
RemoveHeadList(
|
||||||
IN PLIST_ENTRY ListHead)
|
IN PLIST_ENTRY ListHead)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY OldFlink;
|
PLIST_ENTRY Flink;
|
||||||
PLIST_ENTRY OldBlink;
|
PLIST_ENTRY Entry;
|
||||||
PLIST_ENTRY Entry;
|
|
||||||
|
|
||||||
Entry = ListHead->Flink;
|
Entry = ListHead->Flink;
|
||||||
OldFlink = ListHead->Flink->Flink;
|
Flink = Entry->Flink;
|
||||||
OldBlink = ListHead->Flink->Blink;
|
ListHead->Flink = Flink;
|
||||||
OldFlink->Blink = OldBlink;
|
Flink->Blink = ListHead;
|
||||||
OldBlink->Flink = OldFlink;
|
return Entry;
|
||||||
|
|
||||||
if (Entry != ListHead)
|
|
||||||
{
|
|
||||||
Entry->Flink = NULL;
|
|
||||||
Entry->Blink = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline PLIST_ENTRY
|
static __inline PLIST_ENTRY
|
||||||
RemoveTailList(
|
RemoveTailList(
|
||||||
IN PLIST_ENTRY ListHead)
|
IN PLIST_ENTRY ListHead)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY OldFlink;
|
PLIST_ENTRY Blink;
|
||||||
PLIST_ENTRY OldBlink;
|
PLIST_ENTRY Entry;
|
||||||
PLIST_ENTRY Entry;
|
|
||||||
|
|
||||||
Entry = ListHead->Blink;
|
Entry = ListHead->Blink;
|
||||||
OldFlink = ListHead->Blink->Flink;
|
Blink = Entry->Blink;
|
||||||
OldBlink = ListHead->Blink->Blink;
|
ListHead->Blink = Blink;
|
||||||
OldFlink->Blink = OldBlink;
|
Blink->Flink = ListHead;
|
||||||
OldBlink->Flink = OldFlink;
|
|
||||||
|
|
||||||
if (Entry != ListHead)
|
|
||||||
{
|
|
||||||
Entry->Flink = NULL;
|
|
||||||
Entry->Blink = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Entry;
|
return Entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue