1) Add new BaseLib API GetPreviousNode()

2) Clarify comment for the value returned from GetNextNode() if the end of list is reached.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9464 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney 2009-11-21 21:57:11 +00:00
parent e1da91ad12
commit cbca8de588
2 changed files with 67 additions and 4 deletions

View File

@ -1383,8 +1383,7 @@ GetFirstNode (
@param List A pointer to the head node of a doubly linked list.
@param Node A pointer to a node in the doubly linked list.
@return Pointer to the next node if one exists. Otherwise a null value which
is actually List is returned.
@return Pointer to the next node if one exists. Otherwise List is returned.
**/
LIST_ENTRY *
@ -1395,6 +1394,35 @@ GetNextNode (
);
/**
Retrieves the previous node of a doubly linked list.
Returns the node of a doubly linked list that precedes Node.
List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()
or InitializeListHead(). If List is empty, then List is returned.
If List is NULL, then ASSERT().
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
If PcdMaximumLinkedListLenth is not zero, and List contains more than
PcdMaximumLinkedListLenth nodes, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
@param List A pointer to the head node of a doubly linked list.
@param Node A pointer to a node in the doubly linked list.
@return Pointer to the previous node if one exists. Otherwise List is returned.
**/
LIST_ENTRY *
EFIAPI
GetPreviousNode (
IN CONST LIST_ENTRY *List,
IN CONST LIST_ENTRY *Node
);
/**
Checks to see if a doubly linked list is empty or not.

View File

@ -276,8 +276,7 @@ GetFirstNode (
@param List A pointer to the head node of a doubly linked list.
@param Node A pointer to a node in the doubly linked list.
@return Pointer to the next node if one exists. Otherwise a null value which
is actually List is returned.
@return Pointer to the next node if one exists. Otherwise List is returned.
**/
LIST_ENTRY *
@ -295,6 +294,42 @@ GetNextNode (
return Node->ForwardLink;
}
/**
Retrieves the previous node of a doubly linked list.
Returns the node of a doubly linked list that precedes Node.
List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()
or InitializeListHead(). If List is empty, then List is returned.
If List is NULL, then ASSERT().
If Node is NULL, then ASSERT().
If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
InitializeListHead(), then ASSERT().
If PcdMaximumLinkedListLenth is not zero, and List contains more than
PcdMaximumLinkedListLenth nodes, then ASSERT().
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
@param List A pointer to the head node of a doubly linked list.
@param Node A pointer to a node in the doubly linked list.
@return Pointer to the previous node if one exists. Otherwise List is returned.
**/
LIST_ENTRY *
EFIAPI
GetPreviousNode (
IN CONST LIST_ENTRY *List,
IN CONST LIST_ENTRY *Node
)
{
//
// ASSERT List not too long and Node is one of the nodes of List
//
ASSERT (InternalBaseLibIsNodeInList (List, Node, TRUE));
return Node->BackLink;
}
/**
Checks to see if a doubly linked list is empty or not.