]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/list.c
Multiple tidy up, documentation corrections and typo corrections highlighted by Tamas...
[freertos] / FreeRTOS / Source / list.c
index 1421bc6897e36ff13a86036a2dc28d317136b029..a3e6755d991f96e50e7c8273888ab0684899778a 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -101,13 +101,11 @@ void vListInitialiseItem( xListItem * const pxItem )
 \r
 void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem )\r
 {\r
-xListItem * pxIndex;\r
+xListItem * const pxIndex = pxList->pxIndex;\r
 \r
        /* Insert a new list item into pxList, but rather than sort the list,\r
        makes the new list item the last item to be removed by a call to\r
-       pvListGetOwnerOfNextEntry. */\r
-       pxIndex = pxList->pxIndex;\r
-\r
+       listGET_OWNER_OF_NEXT_ENTRY(). */\r
        pxNewListItem->pxNext = pxIndex;\r
        pxNewListItem->pxPrevious = pxIndex->pxPrevious;\r
        pxIndex->pxPrevious->pxNext = pxNewListItem;\r
@@ -123,14 +121,13 @@ xListItem * pxIndex;
 void vListInsert( xList * const pxList, xListItem * const pxNewListItem )\r
 {\r
 xListItem *pxIterator;\r
-portTickType xValueOfInsertion;\r
+const portTickType xValueOfInsertion = pxNewListItem->xItemValue;\r
 \r
-       /* Insert the new list item into the list, sorted in ulListItem order. */\r
-       xValueOfInsertion = pxNewListItem->xItemValue;\r
+       /* Insert the new list item into the list, sorted in xItemValue order.\r
 \r
-       /* If the list already contains a list item with the same item value then\r
+       If the list already contains a list item with the same item value then\r
        the new list item should be placed after it.  This ensures that TCB's which\r
-       are stored in ready lists (all of which have the same ulListItem value)\r
+       are stored in ready lists (all of which have the same xItemValue value)\r
        get an equal share of the CPU.  However, if the xItemValue is the same as\r
        the back marker the iteration loop below will not end.  This means we need\r
        to guard against this by checking the value first and modifying the\r
@@ -180,15 +177,13 @@ portTickType xValueOfInsertion;
 \r
 unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove )\r
 {\r
-xList * pxList;\r
+/* The list item knows which list it is in.  Obtain the list from the list\r
+item. */\r
+xList * const pxList = ( xList * ) pxItemToRemove->pvContainer;\r
 \r
        pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;\r
        pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;\r
 \r
-       /* The list item knows which list it is in.  Obtain the list from the list\r
-       item. */\r
-       pxList = ( xList * ) pxItemToRemove->pvContainer;\r
-\r
        /* Make sure the index is left pointing to a valid item. */\r
        if( pxList->pxIndex == pxItemToRemove )\r
        {\r