Doubly-linked lists


Data Structures

struct  list_node_tag
struct  linked_list_tag

Defines

#define LIST_IS_EMPTY(_x)   (_x->first == NULL)

Typedefs

typedef struct list_node_tag list_node
typedef struct linked_list_tag linked_list

Functions

linked_listalloc_linked_list (void)
void free_linked_list (linked_list *list)
list_nodealloc_list_node (int data_size)
void free_list_node (list_node *node)
void append_list_node (linked_list *list, list_node *node)
void prepend_list_node (linked_list *list, list_node *node)
void remove_list_node_link (linked_list *list, list_node *node)
void remove_list_node (linked_list *list, list_node *node)
void move_list_node (linked_list *src_list, linked_list *dst_list, list_node *node)
void insert_before_list_node (linked_list *list, list_node *node, list_node *new_node)
void insert_after_list_node (linked_list *list, list_node *node, list_node *new_node)

Detailed Description


Define Documentation

#define LIST_IS_EMPTY ( _x   )     (_x->first == NULL)

This macro evaluates to 1 if list _x is empty


Typedef Documentation

typedef struct list_node_tag list_node

List node structure

typedef struct linked_list_tag linked_list

Doubly-linked list structure

This structure represents a doubly-linked list.


Function Documentation

linked_list* alloc_linked_list ( void   ) 

Allocate new doubly-linked list

This function allocates new doubly-linked list.

Returns:
New list pointer

References linked_list_tag::first, linked_list_tag::last, and xmalloc().

Referenced by alloc_LIS_slots(), speck_decode(), and speck_encode().

void free_linked_list ( linked_list list  ) 

Release doubly-linked list

This function releases doubly-linked list with all its internal nodes. Data blocks associated with nodes are also released.

Returns:
VOID

References linked_list_tag::first, free_list_node(), and list_node_tag::next.

Referenced by free_LIS_slots(), speck_decode(), and speck_encode().

list_node* alloc_list_node ( int  data_size  ) 

Allocate new list node

This function allocates new list node with associated data block of size data_size.

Returns:
New node pointer

References list_node_tag::data, list_node_tag::next, list_node_tag::prev, and xmalloc().

Referenced by speck_decode_I(), speck_decode_S(), speck_encode_I(), speck_encode_S(), and speck_init().

void free_list_node ( list_node node  ) 

Release list node

This function releases list node and data block associated with it.

Returns:
VOID

References list_node_tag::data.

Referenced by free_linked_list(), remove_list_node(), speck_decode_I(), speck_encode_I(), speck_process_S(), and speck_unprocess_S().

void append_list_node ( linked_list list,
list_node node 
)

Append list node

This function appends new node to the list tail.

Note:
Node must be properly allocated beforehand.
Returns:
VOID

References linked_list_tag::first, linked_list_tag::last, list_node_tag::next, and list_node_tag::prev.

Referenced by insert_after_list_node(), move_list_node(), speck_decode_S(), speck_encode_S(), speck_process_S(), and speck_unprocess_S().

void prepend_list_node ( linked_list list,
list_node node 
)

Prepend list node

This function prepends new node to the list head.

Note:
Node must be properly allocated beforehand.
Returns:
VOID

References linked_list_tag::first, linked_list_tag::last, list_node_tag::next, and list_node_tag::prev.

Referenced by insert_before_list_node(), speck_decode_S(), speck_encode_S(), speck_init(), speck_process_S(), and speck_unprocess_S().

void remove_list_node_link ( linked_list list,
list_node node 
)

Remove list node

This function removes node links from the list.

Note:
The node itself is not released and can be added to another list.
Returns:
VOID

References linked_list_tag::first, linked_list_tag::last, list_node_tag::next, and list_node_tag::prev.

Referenced by move_list_node(), remove_list_node(), speck_process_S(), and speck_unprocess_S().

void remove_list_node ( linked_list list,
list_node node 
)

Remove list node

This function removes node from the list.

Note:
The node itself is released and cannot be added to another list.
Returns:
VOID

References free_list_node(), and remove_list_node_link().

Referenced by speck_process_S(), and speck_unprocess_S().

void move_list_node ( linked_list src_list,
linked_list dst_list,
list_node node 
)

Move node

This function moves node from src_list to dst_list.

Returns:
VOID

References append_list_node(), and remove_list_node_link().

void insert_before_list_node ( linked_list list,
list_node node,
list_node new_node 
)

Insert node

This function inserts new_node to the list just before node.

Returns:
VOID

References linked_list_tag::first, list_node_tag::next, prepend_list_node(), and list_node_tag::prev.

void insert_after_list_node ( linked_list list,
list_node node,
list_node new_node 
)

Insert node

This function inserts new_node to the list just after node.

Returns:
VOID

References append_list_node(), linked_list_tag::last, list_node_tag::next, and list_node_tag::prev.


Generated on Fri May 27 14:50:00 2011 for EPSILON by  doxygen 1.5.6