view 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
line wrap: on
line source

#ifndef C_LINKED_LIST_H
#define C_LINKED_LIST_H

/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>

typedef struct LinkedListNode LinkedListNode;
typedef struct LinkedList LinkedList;

LinkedList* LinkedList_Create();

void LinkedList_Free(LinkedList* linked_list);

void* LinkedList_Front(LinkedList* linked_list);
void* LinkedList_Back(LinkedList* linked_list);

unsigned int LinkedList_PushFront(LinkedList* linked_list, void* new_item);

unsigned int LinkedList_PushBack(LinkedList* linked_list, void* new_item);

void* LinkedList_PopFront(LinkedList* linked_list);

void* LinkedList_PopBack(LinkedList* linked_list);

size_t LinkedList_Size(LinkedList* linked_list);

void LinkedList_Clear(LinkedList* linked_list);

void* LinkedListNode_GetData(LinkedListNode* list_node);

LinkedListNode* LinkedList_Find(LinkedList* linked_list, void* the_data, LinkedListNode* start_node);

unsigned int LinkedList_Remove(LinkedList* linked_list, LinkedListNode* list_node);

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
	
#endif /* C_LINKED_LIST_H */