comparison LinkedList.c @ 21:14c22fc3c753

Fix to LinkedList_Clear
author Eric Wing <ewing . public |-at-| gmail . com>
date Fri, 24 Dec 2010 03:17:10 -0800
parents d58eb38c771b
children
comparison
equal deleted inserted replaced
19:a8d96c934e77 21:14c22fc3c753
249 return linked_list->currentSize; 249 return linked_list->currentSize;
250 } 250 }
251 251
252 void LinkedList_Clear(LinkedList* linked_list) 252 void LinkedList_Clear(LinkedList* linked_list)
253 { 253 {
254 LinkedListNode* current_node;
255 LinkedListNode* next_node;
254 if(NULL == linked_list) 256 if(NULL == linked_list)
255 { 257 {
256 return; 258 return;
257 } 259 }
258 260
259 LinkedListNode* current_node = linked_list->headPtr; 261 current_node = linked_list->headPtr;
260 LinkedListNode* next_node;
261 while(NULL != current_node) 262 while(NULL != current_node)
262 { 263 {
263 next_node = current_node->nextNode; 264 next_node = current_node->nextNode;
264 LinkedListNode_Free(current_node); 265 LinkedListNode_Free(current_node);
265 current_node = next_node; 266 current_node = next_node;