/* Removes all items from the linked list. Keep in mind that it is the caller's responsibility to release the memory of the items that were placed in the list, before calling this function.  */
void TbxListClear(tTbxList *list)
/* Removes all items from the linked list. Keep in mind that it is the caller's responsibility to release the memory of the items that were placed in the list, before calling this function.  */
void TbxListClear(tTbxList *list)
{
  tTbxListNode * currentListNodePtr;
  TBX_ASSERT(list != NULL);
  if (list != NULL)
  {
    TbxCriticalSectionEnter();
    currentListNodePtr = list->firstNodePtr;
    while (currentListNodePtr != NULL)
    {
      tTbxListNode * tempListNodePtr = currentListNodePtr;
      currentListNodePtr = currentListNodePtr->nextNodePtr;
      TbxMemPoolRelease(tempListNodePtr);
    }
    list->firstNodePtr = NULL;
    list->lastNodePtr = NULL;
    list->nodeCount = 0U;
    TbxCriticalSectionExit();
  }
}