121 lines
2.2 KiB
C
121 lines
2.2 KiB
C
|
/*++
|
||
|
|
||
|
Copyright (c) 1997 Microsoft Corporation
|
||
|
|
||
|
Module Name:
|
||
|
|
||
|
SrvList.h
|
||
|
|
||
|
Abstract:
|
||
|
|
||
|
List package for SrvList.c
|
||
|
|
||
|
Environment:
|
||
|
|
||
|
Console App. User mode.
|
||
|
|
||
|
Revision History:
|
||
|
|
||
|
--*/
|
||
|
|
||
|
//
|
||
|
// Doubly-linked list manipulation routines. Implemented as macros
|
||
|
// but logically these are procedures.
|
||
|
//
|
||
|
|
||
|
//
|
||
|
// VOID
|
||
|
// InitializeListHead(
|
||
|
// PLIST_ENTRY ListHead
|
||
|
// );
|
||
|
//
|
||
|
|
||
|
#define InitializeListHead(ListHead) (\
|
||
|
(ListHead)->Flink = (ListHead)->Blink = (ListHead))
|
||
|
|
||
|
//
|
||
|
// BOOLEAN
|
||
|
// IsListEmpty(
|
||
|
// PLIST_ENTRY ListHead
|
||
|
// );
|
||
|
//
|
||
|
|
||
|
#define IsListEmpty(ListHead) \
|
||
|
((ListHead)->Flink == (ListHead))
|
||
|
|
||
|
//
|
||
|
// PLIST_ENTRY
|
||
|
// RemoveHeadList(
|
||
|
// PLIST_ENTRY ListHead
|
||
|
// );
|
||
|
//
|
||
|
|
||
|
#define RemoveHeadList(ListHead) \
|
||
|
(ListHead)->Flink;\
|
||
|
{RemoveEntryList((ListHead)->Flink)}
|
||
|
|
||
|
//
|
||
|
// PLIST_ENTRY
|
||
|
// RemoveTailList(
|
||
|
// PLIST_ENTRY ListHead
|
||
|
// );
|
||
|
//
|
||
|
|
||
|
#define RemoveTailList(ListHead) \
|
||
|
(ListHead)->Blink;\
|
||
|
{RemoveEntryList((ListHead)->Blink)}
|
||
|
|
||
|
//
|
||
|
// VOID
|
||
|
// RemoveEntryList(
|
||
|
// PLIST_ENTRY Entry
|
||
|
// );
|
||
|
//
|
||
|
|
||
|
#define RemoveEntryList(Entry) {\
|
||
|
PLIST_ENTRY _EX_Blink;\
|
||
|
PLIST_ENTRY _EX_Flink;\
|
||
|
_EX_Flink = (Entry)->Flink;\
|
||
|
_EX_Blink = (Entry)->Blink;\
|
||
|
_EX_Blink->Flink = _EX_Flink;\
|
||
|
_EX_Flink->Blink = _EX_Blink;\
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// VOID
|
||
|
// InsertTailList(
|
||
|
// PLIST_ENTRY ListHead,
|
||
|
// PLIST_ENTRY Entry
|
||
|
// );
|
||
|
//
|
||
|
|
||
|
#define InsertTailList(ListHead,Entry) {\
|
||
|
PLIST_ENTRY _EX_Blink;\
|
||
|
PLIST_ENTRY _EX_ListHead;\
|
||
|
_EX_ListHead = (ListHead);\
|
||
|
_EX_Blink = _EX_ListHead->Blink;\
|
||
|
(Entry)->Flink = _EX_ListHead;\
|
||
|
(Entry)->Blink = _EX_Blink;\
|
||
|
_EX_Blink->Flink = (Entry);\
|
||
|
_EX_ListHead->Blink = (Entry);\
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// VOID
|
||
|
// InsertHeadList(
|
||
|
// PLIST_ENTRY ListHead,
|
||
|
// PLIST_ENTRY Entry
|
||
|
// );
|
||
|
//
|
||
|
|
||
|
#define InsertHeadList(ListHead,Entry) {\
|
||
|
PLIST_ENTRY _EX_Flink;\
|
||
|
PLIST_ENTRY _EX_ListHead;\
|
||
|
_EX_ListHead = (ListHead);\
|
||
|
_EX_Flink = _EX_ListHead->Flink;\
|
||
|
(Entry)->Flink = _EX_Flink;\
|
||
|
(Entry)->Blink = _EX_ListHead;\
|
||
|
_EX_Flink->Blink = (Entry);\
|
||
|
_EX_ListHead->Flink = (Entry);\
|
||
|
}
|