]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/list.c
Improve efficiency and behaviour of vListInsertEnd().
[freertos] / FreeRTOS / Source / list.c
index c916a39457594a3030d3b3d9afb3e4d659274403..1e6a7486d6c955f111198fda86490329065a8542 100644 (file)
@@ -114,15 +114,13 @@ volatile xListItem * pxIndex;
 \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.  This means it has to be the item pointed to by\r
-       the pxIndex member. */\r
+       pvListGetOwnerOfNextEntry. */\r
        pxIndex = pxList->pxIndex;\r
 \r
-       pxNewListItem->pxNext = pxIndex->pxNext;\r
-       pxNewListItem->pxPrevious = pxList->pxIndex;\r
-       pxIndex->pxNext->pxPrevious = ( volatile xListItem * ) pxNewListItem;\r
-       pxIndex->pxNext = ( volatile xListItem * ) pxNewListItem;\r
-       pxList->pxIndex = ( volatile xListItem * ) pxNewListItem;\r
+       pxNewListItem->pxNext = pxIndex;\r
+       pxNewListItem->pxPrevious = pxIndex->pxPrevious;\r
+       pxIndex->pxPrevious->pxNext = ( volatile xListItem * ) pxNewListItem;\r
+       pxIndex->pxPrevious = ( volatile xListItem * ) pxNewListItem;   \r
 \r
        /* Remember which list the item is in. */\r
        pxNewListItem->pvContainer = ( void * ) pxList;\r