]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/LinkedList.c
remove unnecessary comments introduced by tools from MdePkg. The regular express...
[mirror_edk2.git] / MdePkg / Library / BaseLib / LinkedList.c
index 846a8132691dfd0bd4c4164b9f3ff0ba2f71bfb1..86bc495cc98a922e48abf9f23d74269f4a451e8d 100644 (file)
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-  Module Name:  LinkedList.c\r
-\r
 **/\r
 \r
+\r
+\r
+\r
+#include "BaseLibInternals.h"\r
+\r
+/**\r
+  Worker function that locates the Node in the List\r
+\r
+  By searching the List, finds the location of the Node in List. At the same time,\r
+  verifies the validity of this list.\r
+\r
+  If List is NULL, then ASSERT().\r
+  If List->ForwardLink is NULL, then ASSERT().\r
+  If List->backLink is NULL, then ASSERT().\r
+  If Node is NULL, then ASSERT();\r
+  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
+  of nodes in ListHead, including the ListHead node, is greater than or\r
+  equal to PcdMaximumLinkedListLength, then ASSERT().\r
+\r
+  @param  List  A pointer to a node in a linked list.\r
+  @param  Node  A pointer to one nod.\r
+\r
+  @retval TRUE   Node is in List\r
+  @retval FALSE  Node isn't in List, or List is invalid\r
+\r
+**/\r
 BOOLEAN\r
 EFIAPI\r
 IsNodeInList (\r
@@ -34,9 +58,6 @@ IsNodeInList (
   ASSERT (Node != NULL);\r
 \r
   Count = PcdGet32 (PcdMaximumLinkedListLength);\r
-  if (Count != 0) {\r
-    Count++;\r
-  }\r
 \r
   Ptr = List;\r
   do {\r
@@ -67,7 +88,7 @@ IsNodeInList (
 \r
   If ListHead is NULL, then ASSERT().\r
 \r
-  @param  ListHead  A pointer to the head node of a new doubly linked list.\r
+  @param  List  A pointer to the head node of a new doubly linked list.\r
 \r
   @return ListHead\r
 \r
@@ -96,10 +117,11 @@ InitializeListHead (
   If ListHead is NULL, then ASSERT().\r
   If Entry is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and ListHead contains more than\r
-  PcdMaximumLinkedListLenth nodes, then ASSERT().\r
+  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
+  of nodes in ListHead, including the ListHead node, is greater than or\r
+  equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
-  @param  ListHead  A pointer to the head node of a doubly linked list.\r
+  @param  List      A pointer to the head node of a doubly linked list.\r
   @param  Entry     A pointer to a node that is to be inserted at the beginning\r
                     of a doubly linked list.\r
 \r
@@ -135,10 +157,11 @@ InsertHeadList (
   If ListHead is NULL, then ASSERT().\r
   If Entry is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and ListHead contains more than\r
-  PcdMaximumLinkedListLenth nodes, then ASSERT().\r
+  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
+  of nodes in ListHead, including the ListHead node, is greater than or\r
+  equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
-  @param  ListHead  A pointer to the head node of a doubly linked list.\r
+  @param  List      A pointer to the head node of a doubly linked list.\r
   @param  Entry     A pointer to a node that is to be added at the end of the\r
                     doubly linked list.\r
 \r
@@ -173,8 +196,9 @@ InsertTailList (
 \r
   If List is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than\r
-  PcdMaximumLinkedListLenth nodes, then ASSERT().\r
+  If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r
+  in List, including the List node, is greater than or equal to\r
+  PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  List  A pointer to the head node of a doubly linked list.\r
 \r
@@ -240,10 +264,11 @@ GetNextNode (
 \r
   If ListHead is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than\r
-  PcdMaximumLinkedListLenth nodes, then ASSERT().\r
+  If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r
+  in List, including the List node, is greater than or equal to\r
+  PcdMaximumLinkedListLength, then ASSERT().\r
 \r
-  @param  ListHead  A pointer to the head node of a doubly linked list.\r
+  @param  List  A pointer to the head node of a doubly linked list.\r
 \r
   @retval TRUE  The linked list is empty.\r
   @retval FALSE The linked list is not empty.\r
@@ -273,8 +298,9 @@ IsListEmpty (
   If List is NULL, then ASSERT().\r
   If Node is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than\r
-  PcdMaximumLinkedListLenth nodes, then ASSERT().\r
+  If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r
+  in List, including the List node, is greater than or equal to\r
+  PcdMaximumLinkedListLength, then ASSERT().\r
   If Node is not a node in List and Node is not equal to List, then ASSERT().\r
 \r
   @param  List  A pointer to the head node of a doubly linked list.\r
@@ -309,8 +335,9 @@ IsNull (
   If List is NULL, then ASSERT().\r
   If Node is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than\r
-  PcdMaximumLinkedListLenth nodes, then ASSERT().\r
+  If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r
+  in List, including the List node, is greater than or equal to\r
+  PcdMaximumLinkedListLength, then ASSERT().\r
   If Node is not a node in List, then ASSERT().\r
 \r
   @param  List  A pointer to the head node of a doubly linked list.\r
@@ -349,12 +376,15 @@ IsNodeAtEnd (
   If FirstEntry is NULL, then ASSERT().\r
   If SecondEntry is NULL, then ASSERT().\r
   If SecondEntry and FirstEntry are not in the same linked list, then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and the linked list containing\r
-  FirstEntry and SecondEntry contains more than PcdMaximumLinkedListLenth\r
-  nodes, then ASSERT().\r
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r
+  linked list containing the FirstEntry and SecondEntry nodes, including\r
+  the FirstEntry and SecondEntry nodes, is greater than or equal to\r
+  PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  FirstEntry  A pointer to a node in a linked list.\r
   @param  SecondEntry A pointer to another node in the same linked list.\r
+  \r
+  @return SecondEntry\r
 \r
 **/\r
 LIST_ENTRY *\r
@@ -416,8 +446,9 @@ SwapListEntries (
 \r
   If Entry is NULL, then ASSERT().\r
   If Entry is the head node of an empty list, then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and the linked list containing\r
-  Entry contains more than PcdMaximumLinkedListLenth nodes, then ASSERT().\r
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r
+  linked list containing Entry, including the Entry node, is greater than\r
+  or equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  Entry A pointer to a node in a linked list\r
 \r