Main Page | Data Structures | File List | Globals

list.h File Reference

Go to the source code of this file.

Data Structures

struct  list_node

Functions

void delete_list (struct list_node *list, void(*delete_data)(void *))
void add_list_node (struct list_node **list, void *data)
void * remove_list_node (struct list_node *node, void(*delete_data)(void *))
list_nodefind_list_node (struct list_node *list, void *data, int(*cmp_func)(void *, void *))
unsigned int count_list_nodes (struct list_node *list)


Detailed Description

A generic linked list implementation, that provides the functionality of a doubly-linked list and works on generic void* data pointers.

Function Documentation

void add_list_node struct list_node **  list,
void *  data
 

adds a new node to the list, containing the data pointer specified at the second argument

unsigned int count_list_nodes struct list_node list  ) 
 

counts and returns the number of elements in the list.

void delete_list struct list_node list,
void(*  delete_data)(void *)
 

delete the whole list, calling a custom deallocation function on the generic data pointers, if one is provided.

struct list_node* find_list_node struct list_node list,
void *  data,
int(*  cmp_func)(void *, void *)
 

finds the specified data item on the list, the provided comparison function is used to compare each element of the list with the second argument.

Returns the node if it finds a match, NULL otherwise

void* remove_list_node struct list_node node,
void(*  delete_data)(void *)
 

removes the specified node from the list, optionally calling a custom deallocation function provided at the second argument, on the data of that node.

Returns the data pointer if no deallocation function is specified, NULL otherwise


Generated on Thu Sep 9 00:52:33 2004 for MUD by doxygen 1.3.8