comparison LinkedList.h @ 13:54aa96ae8912

Added LinkedList class to project. ALmixer now saves ALmixer_Data instances in a private linked list so when Quit is called, this memory can be cleaned up. This is meant to deal with two problems. First, SDL_sound does something similar which means since I wrap SDL_sound structures, I may be left with dangling pointers if. Second is the obvious auto-cleanup when quiting which is convenient for resetting.
author Eric Wing <ewing . public |-at-| gmail . com>
date Sat, 06 Nov 2010 00:37:29 -0700
parents
children 1c27a52c5b15
comparison
equal deleted inserted replaced
12:bfe90b4f3d87 13:54aa96ae8912
1 #ifndef C_LINKED_LIST_H
2 #define C_LINKED_LIST_H
3
4 /* Set up for C function definitions, even when using C++ */
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 #include <stddef.h>
10
11 typedef struct LinkedListNode LinkedListNode;
12 typedef struct LinkedList LinkedList;
13
14 LinkedList* LinkedList_Create();
15
16 void LinkedList_Free(LinkedList* linked_list);
17
18 void* LinkedList_Front(LinkedList* linked_list);
19 void* LinkedList_Back(LinkedList* linked_list);
20
21 unsigned int LinkedList_PushFront(LinkedList* linked_list, void* new_item);
22
23 unsigned int LinkedList_PushBack(LinkedList* linked_list, void* new_item);
24
25 void* LinkedList_PopFront(LinkedList* linked_list);
26
27 void* LinkedList_PopBack(LinkedList* linked_list);
28
29 size_t LinkedList_Size(LinkedList* linked_list);
30
31 void LinkedList_Clear(LinkedList* linked_list);
32
33 void* LinkedListNode_GetData(LinkedListNode* list_node);
34
35 LinkedListNode* LinkedList_Find(LinkedList* linked_list, void* the_data, LinkedListNode* start_node);
36
37 unsigned int LinkedList_Remove(LinkedList* linked_list, LinkedListNode* list_node);
38
39 /* Ends C function definitions when using C++ */
40 #ifdef __cplusplus
41 }
42 #endif
43
44 #endif /* C_LINKED_LIST_H */
45