Mercurial > almixer_isolated
diff LinkedList.c @ 17:d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Sat, 06 Nov 2010 04:00:44 -0700 |
parents | b27f7ff5e44b |
children | 14c22fc3c753 |
line wrap: on
line diff
--- a/LinkedList.c Sat Nov 06 03:59:28 2010 -0700 +++ b/LinkedList.c Sat Nov 06 04:00:44 2010 -0700 @@ -183,7 +183,7 @@ tail_node = linked_list->tailPtr; return_data = tail_node->dataPtr; - if(1 == linked_list->currentSize) + if(1 == linked_list->currentSize) { LinkedList_Clear(linked_list); } @@ -198,6 +198,48 @@ return return_data; } + +void* LinkedList_Front(LinkedList* linked_list) +{ + LinkedListNode* head_node; + void* return_data; + + if(NULL == linked_list) + { + return 0; + } + if(0 == linked_list->currentSize) + { + return NULL; + } + + head_node = linked_list->headPtr; + return_data = head_node->dataPtr; + + return return_data; +} + +void* LinkedList_Back(LinkedList* linked_list) +{ + LinkedListNode* tail_node; + void* return_data; + + if(NULL == linked_list) + { + return NULL; + } + if(0 == linked_list->currentSize) + { + return NULL; + } + + tail_node = linked_list->tailPtr; + return_data = tail_node->dataPtr; + + return return_data; +} + + size_t LinkedList_Size(LinkedList* linked_list) { if(NULL == linked_list)