dlist.c File Reference

Generic doubly-linked list routines. More...

#include "common.h"
#include "dlist.h"

Go to the source code of this file.

Functions

void dlAddAfter (dlNode *anchor, dlNode *newNode)
 Add a node to list after anchor member.
void dlAddBefore (dlNode *anchor, dlNode *newNode)
 Add a node to list before anchor member.
void dlAddHead (dlList *list, dlNode *newNode)
 Add a node to head of list.
void dlAddTail (dlList *list, dlNode *newNode)
 Add a node to tail of list.
dlNodedlAddValAfter (dlNode *anchor, void *val)
 Create a node containing val and add to list after anchor member.
dlNodedlAddValBefore (dlNode *anchor, void *val)
 Create a node containing val and add to list before anchor member.
dlNodedlAddValHead (dlList *list, void *val)
 Create a node containing val and add to head of list.
dlNodedlAddValTail (dlList *list, void *val)
 Create a node containing val and add to tail of list.
void dlCat (dlList *a, dlList *b)
 Move items from b to end of a.
int dlCount (dlList *list)
 Return length of list.
void dlDelete (dlNode **nodePtr)
 Removes a node from list and frees it.
int dlEmpty (dlList *list)
 Return 1 if list is empty.
dlNodedlGetAfterTail (dlList *list)
 Get the node after the tail of the list.
dlNodedlGetBeforeHead (dlList *list)
 Get the node before the head of the list.
void dlListFree (dlList **pList)
 Free up a doubly linked list and it's nodes, but not the node values.
void dlListFreeAndVals (dlList **pList)
 Free all values in doubly linked list and the list itself.
void dlListInit (dlList *dl)
 Initialize list to be empty.
dlListdlListNew (void)
 Return a new doubly linked list.
void dlListReset (dlList *dl)
 Reset a list to the empty state (does not free values).
dlNodedlPopHead (dlList *list)
 Remove first node from list and return it.
dlNodedlPopTail (dlList *list)
 Remove last node from list and return it.
void dlRemove (dlNode *node)
 Removes a node from list.
void dlRemoveHead (dlList *list)
 Removes head from list.
void dlRemoveTail (dlList *list)
 Remove tail from list.
void dlSort (dlList *list, int(*compare)(const void *elem1, const void *elem2))
 Sort a singly linked list with Qsort and a temporary array.
dlNodedlValInList (dlList *list, void *val)
 Return node on list if any that has associated val.


Detailed Description

Generic doubly-linked list routines.

Author:
Adapted by Lukas Habegger (lukas.habegger@yale.edu)

Definition in file dlist.c.


Function Documentation

void dlListFreeAndVals ( dlList **  pList  ) 

Free all values in doubly linked list and the list itself.

Just calls freeMem on all values.

Definition at line 81 of file dlist.c.

void dlRemove ( dlNode node  ) 

Removes a node from list.

Node is not freed.

Definition at line 202 of file dlist.c.

void dlRemoveHead ( dlList list  ) 

Removes head from list.

Node is not freed.

Definition at line 217 of file dlist.c.

void dlRemoveTail ( dlList list  ) 

Remove tail from list.

Node is not freed.

Definition at line 227 of file dlist.c.

void dlSort ( dlList list,
int(*)(const void *elem1, const void *elem2)  compare 
)

Sort a singly linked list with Qsort and a temporary array.

The arguments to the compare function in real, non-void, life are pointers to pointers of the type that is in the val field of the nodes of the list.

Definition at line 321 of file dlist.c.


Generated on Fri Aug 7 15:46:42 2009 for BIOS by  doxygen 1.5.7.1