mirror of
https://github.com/reactos/reactos.git
synced 2024-09-11 05:12:43 +00:00
Changed list functions to macros (or static inline functions).
svn path=/trunk/; revision=1201
This commit is contained in:
parent
e3b8762528
commit
44bdd793c1
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rtl.h,v 1.34 2000/05/13 01:44:53 ekohl Exp $
|
||||
/* $Id: rtl.h,v 1.35 2000/06/18 15:20:10 ekohl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -169,7 +169,6 @@ extern BOOLEAN NLS_MB_OEM_CODE_PAGE_TAG;
|
|||
* RootDirectory = Where the object should be placed or NULL
|
||||
* SecurityDescriptor = Ignored
|
||||
*/
|
||||
|
||||
#define InitializeObjectAttributes(p,n,a,r,s) \
|
||||
{ \
|
||||
(p)->Length = sizeof(OBJECT_ATTRIBUTES); \
|
||||
|
@ -180,53 +179,248 @@ extern BOOLEAN NLS_MB_OEM_CODE_PAGE_TAG;
|
|||
(p)->SecurityQualityOfService = NULL; \
|
||||
}
|
||||
|
||||
VOID
|
||||
InitializeListHead (
|
||||
PLIST_ENTRY ListHead
|
||||
);
|
||||
|
||||
VOID
|
||||
InsertHeadList (
|
||||
PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY Entry
|
||||
);
|
||||
/*
|
||||
* VOID
|
||||
* InitializeListHead (
|
||||
* PLIST_ENTRY ListHead
|
||||
* );
|
||||
*
|
||||
* FUNCTION: Initializes a double linked list
|
||||
* ARGUMENTS:
|
||||
* ListHead = Caller supplied storage for the head of the list
|
||||
*/
|
||||
#define InitializeListHead(ListHead) \
|
||||
{ \
|
||||
(ListHead)->Flink = (ListHead); \
|
||||
(ListHead)->Blink = (ListHead); \
|
||||
}
|
||||
|
||||
VOID
|
||||
InsertTailList (
|
||||
PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY Entry
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
IsListEmpty (
|
||||
PLIST_ENTRY ListHead
|
||||
);
|
||||
/*
|
||||
* VOID
|
||||
* InsertHeadList (
|
||||
* PLIST_ENTRY ListHead,
|
||||
* PLIST_ENTRY Entry
|
||||
* );
|
||||
*
|
||||
* FUNCTION: Inserts an entry in a double linked list
|
||||
* ARGUMENTS:
|
||||
* ListHead = Head of the list
|
||||
* Entry = Entry to insert
|
||||
*/
|
||||
#define InsertHeadList(ListHead, ListEntry) \
|
||||
{ \
|
||||
PLIST_ENTRY OldFlink; \
|
||||
OldFlink = (ListHead)->Flink; \
|
||||
(ListEntry)->Flink = OldFlink; \
|
||||
(ListEntry)->Blink = (ListHead); \
|
||||
OldFlink->Blink = (ListEntry); \
|
||||
(ListHead)->Flink = (ListEntry); \
|
||||
assert((ListEntry) != NULL); \
|
||||
assert((ListEntry)->Blink!=NULL); \
|
||||
assert((ListEntry)->Blink->Flink == (ListEntry)); \
|
||||
assert((ListEntry)->Flink != NULL); \
|
||||
assert((ListEntry)->Flink->Blink == (ListEntry)); \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* VOID
|
||||
* InsertTailList (
|
||||
* PLIST_ENTRY ListHead,
|
||||
* PLIST_ENTRY Entry
|
||||
* );
|
||||
*
|
||||
* FUNCTION: Inserts an entry in a double linked list
|
||||
* ARGUMENTS:
|
||||
* ListHead = Head of the list
|
||||
* Entry = Entry to insert
|
||||
*/
|
||||
#define InsertTailList(ListHead, ListEntry) \
|
||||
{ \
|
||||
PLIST_ENTRY OldBlink; \
|
||||
OldBlink = (ListHead)->Blink; \
|
||||
(ListEntry)->Flink = (ListHead); \
|
||||
(ListEntry)->Blink = OldBlink; \
|
||||
OldBlink->Flink = (ListEntry); \
|
||||
(ListHead)->Blink = (ListEntry); \
|
||||
assert((ListEntry) != NULL); \
|
||||
assert((ListEntry)->Blink!=NULL); \
|
||||
assert((ListEntry)->Blink->Flink == (ListEntry)); \
|
||||
assert((ListEntry)->Flink != NULL); \
|
||||
assert((ListEntry)->Flink->Blink == (ListEntry)); \
|
||||
}
|
||||
|
||||
/*
|
||||
* BOOLEAN
|
||||
* IsListEmpty (
|
||||
* PLIST_ENTRY ListHead
|
||||
* );
|
||||
*
|
||||
* FUNCTION:
|
||||
* Checks if a double linked list is empty
|
||||
*
|
||||
* ARGUMENTS:
|
||||
* ListHead = Head of the list
|
||||
*/
|
||||
#define IsListEmpty(ListHead) \
|
||||
((ListHead)->Flink == (ListHead))
|
||||
|
||||
|
||||
PSINGLE_LIST_ENTRY
|
||||
PopEntryList (
|
||||
PSINGLE_LIST_ENTRY ListHead
|
||||
);
|
||||
/*
|
||||
#define PopEntryList(ListHead) \
|
||||
(ListHead)->Next; \
|
||||
{ \
|
||||
PSINGLE_LIST_ENTRY FirstEntry; \
|
||||
FirstEntry = (ListHead)->Next; \
|
||||
if (FirstEntry != NULL) \
|
||||
{ \
|
||||
(ListHead)->Next = FirstEntry->Next; \
|
||||
} \
|
||||
}
|
||||
*/
|
||||
|
||||
VOID
|
||||
PushEntryList (
|
||||
PSINGLE_LIST_ENTRY ListHead,
|
||||
PSINGLE_LIST_ENTRY Entry
|
||||
);
|
||||
/*
|
||||
#define PushEntryList(ListHead,Entry) \
|
||||
(Entry)->Next = (ListHead)->Next; \
|
||||
(ListHead)->Next = (Entry)
|
||||
*/
|
||||
|
||||
VOID
|
||||
RemoveEntryList (
|
||||
PLIST_ENTRY Entry
|
||||
);
|
||||
|
||||
/*
|
||||
*VOID
|
||||
*RemoveEntryList (
|
||||
* PLIST_ENTRY Entry
|
||||
* );
|
||||
*
|
||||
* FUNCTION:
|
||||
* Removes an entry from a double linked list
|
||||
*
|
||||
* ARGUMENTS:
|
||||
* ListEntry = Entry to remove
|
||||
*/
|
||||
#define RemoveEntryList(ListEntry) \
|
||||
{ \
|
||||
PLIST_ENTRY OldFlink; \
|
||||
PLIST_ENTRY OldBlink; \
|
||||
assert((ListEntry) != NULL); \
|
||||
assert((ListEntry)->Blink!=NULL); \
|
||||
assert((ListEntry)->Blink->Flink == (ListEntry)); \
|
||||
assert((ListEntry)->Flink != NULL); \
|
||||
assert((ListEntry)->Flink->Blink == (ListEntry)); \
|
||||
OldFlink = (ListEntry)->Flink; \
|
||||
OldBlink = (ListEntry)->Blink; \
|
||||
OldFlink->Blink = OldBlink; \
|
||||
OldBlink->Flink = OldFlink; \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PLIST_ENTRY
|
||||
* RemoveHeadList (
|
||||
* PLIST_ENTRY ListHead
|
||||
* );
|
||||
*
|
||||
* FUNCTION:
|
||||
* Removes the head entry from a double linked list
|
||||
*
|
||||
* ARGUMENTS:
|
||||
* ListHead = Head of the list
|
||||
*
|
||||
* RETURNS:
|
||||
* The removed entry
|
||||
*/
|
||||
/*
|
||||
#define RemoveHeadList(ListHead) \
|
||||
(ListHead)->Flink; \
|
||||
{RemoveEntryList((ListHead)->Flink)}
|
||||
*/
|
||||
/*
|
||||
PLIST_ENTRY
|
||||
RemoveHeadList (
|
||||
PLIST_ENTRY ListHead
|
||||
);
|
||||
*/
|
||||
|
||||
static
|
||||
inline
|
||||
PLIST_ENTRY
|
||||
RemoveHeadList (
|
||||
PLIST_ENTRY ListHead
|
||||
)
|
||||
{
|
||||
PLIST_ENTRY Old;
|
||||
PLIST_ENTRY OldFlink;
|
||||
PLIST_ENTRY OldBlink;
|
||||
|
||||
Old = ListHead->Flink;
|
||||
|
||||
OldFlink = ListHead->Flink->Flink;
|
||||
OldBlink = ListHead->Flink->Blink;
|
||||
OldFlink->Blink = OldBlink;
|
||||
OldBlink->Flink = OldFlink;
|
||||
|
||||
return(Old);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PLIST_ENTRY
|
||||
* RemoveTailList (
|
||||
* PLIST_ENTRY ListHead
|
||||
* );
|
||||
*
|
||||
* FUNCTION:
|
||||
* Removes the tail entry from a double linked list
|
||||
*
|
||||
* ARGUMENTS:
|
||||
* ListHead = Head of the list
|
||||
* RETURNS:
|
||||
* The removed entry
|
||||
*/
|
||||
/*
|
||||
#define RemoveTailList(ListHead) \
|
||||
(ListHead)->Blink; \
|
||||
{RemoveEntryList((ListHead)->Blink)}
|
||||
*/
|
||||
/*
|
||||
PLIST_ENTRY
|
||||
RemoveTailList (
|
||||
PLIST_ENTRY ListHead
|
||||
);
|
||||
*/
|
||||
|
||||
static
|
||||
inline
|
||||
PLIST_ENTRY
|
||||
RemoveTailList (
|
||||
PLIST_ENTRY ListHead
|
||||
)
|
||||
{
|
||||
PLIST_ENTRY Old;
|
||||
PLIST_ENTRY OldFlink;
|
||||
PLIST_ENTRY OldBlink;
|
||||
|
||||
Old = ListHead->Blink;
|
||||
|
||||
OldFlink = ListHead->Blink->Flink;
|
||||
OldBlink = ListHead->Blink->Blink;
|
||||
OldFlink->Blink = OldBlink;
|
||||
OldBlink->Flink = OldFlink;
|
||||
|
||||
return(Old);
|
||||
}
|
||||
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.def,v 1.75 2000/06/12 14:53:09 ekohl Exp $
|
||||
; $Id: ntoskrnl.def,v 1.76 2000/06/18 15:21:18 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -1014,12 +1014,7 @@ wctomb
|
|||
;
|
||||
; ReactOS Extensions (these should be macros!)
|
||||
;
|
||||
;IoInitializeDpcRequest
|
||||
;IoRequestDpc
|
||||
MmGetSystemAddressForMdl
|
||||
InitializeListHead
|
||||
InsertTailList
|
||||
RemoveEntryList
|
||||
;
|
||||
;
|
||||
; exports from hal.dll
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.edf,v 1.62 2000/06/12 14:53:09 ekohl Exp $
|
||||
; $Id: ntoskrnl.edf,v 1.63 2000/06/18 15:21:18 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -947,12 +947,7 @@ wctomb
|
|||
;
|
||||
; ReactOS Extensions
|
||||
;
|
||||
;IoInitializeDpcRequest
|
||||
;IoRequestDpc
|
||||
MmGetSystemAddressForMdl
|
||||
InitializeListHead
|
||||
InsertTailList
|
||||
RemoveEntryList
|
||||
;
|
||||
;
|
||||
; exports from hal.dll
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: list.c,v 1.6 2000/06/07 13:05:09 ekohl Exp $
|
||||
/* $Id: list.c,v 1.7 2000/06/18 15:21:53 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -16,6 +16,7 @@
|
|||
|
||||
/* FUNCTIONS *************************************************************/
|
||||
|
||||
#if 0
|
||||
static BOOLEAN CheckEntry(PLIST_ENTRY ListEntry)
|
||||
{
|
||||
assert(ListEntry!=NULL);
|
||||
|
@ -26,36 +27,6 @@ static BOOLEAN CheckEntry(PLIST_ENTRY ListEntry)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
BOOLEAN IsListEmpty(PLIST_ENTRY ListHead)
|
||||
/*
|
||||
* FUNCTION: Determines if a list is empty
|
||||
* ARGUMENTS:
|
||||
* ListHead = Head of the list
|
||||
* RETURNS: True if there are no entries in the list
|
||||
*/
|
||||
{
|
||||
return(ListHead->Flink==ListHead);
|
||||
}
|
||||
|
||||
VOID RemoveEntryList(PLIST_ENTRY ListEntry)
|
||||
{
|
||||
PLIST_ENTRY OldFlink;
|
||||
PLIST_ENTRY OldBlink;
|
||||
|
||||
DPRINT("RemoveEntryList(ListEntry %x)\n", ListEntry);
|
||||
|
||||
assert(CheckEntry(ListEntry));
|
||||
|
||||
OldFlink=ListEntry->Flink;
|
||||
OldBlink=ListEntry->Blink;
|
||||
|
||||
OldFlink->Blink=OldBlink;
|
||||
OldBlink->Flink=OldFlink;
|
||||
|
||||
|
||||
DPRINT("RemoveEntryList()\n");
|
||||
}
|
||||
|
||||
PLIST_ENTRY RemoveTailList(PLIST_ENTRY ListHead)
|
||||
/*
|
||||
* FUNCTION: Remove the tail entry from a double linked list
|
||||
|
@ -84,46 +55,8 @@ PLIST_ENTRY RemoveHeadList(PLIST_ENTRY ListHead)
|
|||
|
||||
return(Old);
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID InitializeListHead(PLIST_ENTRY ListHead)
|
||||
/*
|
||||
* FUNCTION: Initializes a double linked list
|
||||
* ARGUMENTS:
|
||||
* ListHead = Caller supplied storage for the head of the list
|
||||
*/
|
||||
{
|
||||
ListHead->Flink = ListHead->Blink = ListHead;
|
||||
}
|
||||
|
||||
VOID InsertTailList(PLIST_ENTRY ListHead, PLIST_ENTRY ListEntry)
|
||||
/*
|
||||
* FUNCTION: Inserts an entry in a double linked list
|
||||
* ARGUMENTS:
|
||||
* ListHead = Head of the list
|
||||
* Entry = Entry to insert
|
||||
*/
|
||||
{
|
||||
PLIST_ENTRY Blink;
|
||||
|
||||
Blink = ListHead->Blink;
|
||||
ListEntry->Flink=ListHead;
|
||||
ListEntry->Blink=Blink;
|
||||
Blink->Flink=ListEntry;
|
||||
ListHead->Blink=ListEntry;
|
||||
assert(CheckEntry(ListEntry));
|
||||
}
|
||||
|
||||
VOID InsertHeadList(PLIST_ENTRY ListHead, PLIST_ENTRY ListEntry)
|
||||
{
|
||||
PLIST_ENTRY OldFlink;
|
||||
|
||||
OldFlink = ListHead->Flink;
|
||||
ListEntry->Flink = OldFlink;
|
||||
ListEntry->Blink = ListHead;
|
||||
OldFlink->Blink = ListEntry;
|
||||
ListHead->Flink = ListEntry;
|
||||
assert( CheckEntry( ListEntry ) );
|
||||
}
|
||||
|
||||
PLIST_ENTRY
|
||||
STDCALL
|
||||
|
@ -216,8 +149,11 @@ ExInterlockedRemoveHeadList (
|
|||
return(ret);
|
||||
}
|
||||
|
||||
PLIST_ENTRY ExInterlockedRemoveTailList(PLIST_ENTRY Head,
|
||||
PKSPIN_LOCK Lock)
|
||||
PLIST_ENTRY
|
||||
ExInterlockedRemoveTailList (
|
||||
PLIST_ENTRY Head,
|
||||
PKSPIN_LOCK Lock
|
||||
)
|
||||
/*
|
||||
* FUNCTION: Removes the tail of a double linked list
|
||||
* ARGUMENTS:
|
||||
|
|
Loading…
Reference in a new issue