/*\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
\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
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
\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