Mir 1.0
Mir application programming interface
Double-Linked Cached List routines

Data Structures

struct  mirkl_cdllist_t_
 Structure of Double-Linked Cached List. More...
 

Typedefs

typedef struct mirkl_cdllist_t_ mirkl_cdllist_t
 Structure of Double-Linked Cached List.
 

Functions

mirkl_error_tmirkl_cdl_append (mirkl_cdllist_t **list, int Tag, void *Object, mirkl_cdllist_t **newObj, apr_pool_t *pool)
 Appends (i.e. adds to the end of the list) data to the list. More...
 
mirkl_error_tmirkl_cdl_add (mirkl_cdllist_t **Item, int Tag, void *Object, mirkl_cdllist_t **newObj, apr_pool_t *pool)
 Add an item to the list. Position of the new item in the list is implementation-dependent. More...
 
mirkl_error_tmirkl_cdl_prepend (mirkl_cdllist_t **list, int Tag, void *Object, mirkl_cdllist_t **newObj, apr_pool_t *pool)
 Prepends (i.e. adds to the start of the list) data to the list.
 
mirkl_cdllist_tmirkl_cdl_get_first (mirkl_cdllist_t *List)
 Retrieve the first node of the list.
 
mirkl_cdllist_tmirkl_cdl_get_last (mirkl_cdllist_t *List)
 Retrieve the last node of the list.
 
mirkl_cdllist_tmirkl_cdl_get_n (mirkl_cdllist_t *List, mirkl_size_t n)
 
mirkl_cdllist_tmirkl_cdl_get_ready (mirkl_cdllist_t *List)
 
void * mirkl_cdl_get_data (mirkl_cdllist_t *Item)
 
void mirkl_cdl_set_data (mirkl_cdllist_t *Item, void *data)
 
int mirkl_cdl_get_tag (mirkl_cdllist_t *Item)
 
void mirkl_cdl_set_tag (mirkl_cdllist_t *Item, int tag)
 
void mirkl_cdl_set_data_tag (mirkl_cdllist_t *Item, void *data, int tag)
 
void mirkl_cdl_set_free (mirkl_cdllist_t *Item)
 
void mirkl_cdl_set_free_obj (mirkl_cdllist_t *List, void *pobj)
 
void mirkl_cdl_set_allfree (mirkl_cdllist_t *List)
 
void mirkl_cdl_set_occupied (mirkl_cdllist_t *Item)
 
void mirkl_cdl_destroy (mirkl_cdllist_t **List)
 
mirkl_uint64_t mirkl_cdl_count (mirkl_cdllist_t *List)
 
void mirkl_cdl_walk (mirkl_cdllist_t *List, void(*Func)(int, void *, void *), void *Args)
 Walking through the list and executing the user-supplied function with each of the nodes. More...
 
void mirkl_cdl_walk_free (mirkl_cdllist_t *List, int(*Func)(int, void *, void *), void *Args)
 
mirkl_cdllist_tmirkl_cdl_walk_node_first (mirkl_cdllist_t *List, int(*Func)(int, void *, void *), void *Args)
 
int mirkl_cdl_walk_int_first (mirkl_cdllist_t *List, int(*Func)(int, void *, void *), void *Args)
 
void * mirkl_cdl_walk_ptr_first (mirkl_cdllist_t *List, void *(*Func)(int, void *, void *), void *Args)
 
mirkl_error_tmirkl_cdl_walk_err_or_ptr_first (mirkl_cdllist_t *list, mirkl_error_t *(*func)(int, void *, void *, void **), void *args, void **ret)
 
mirkl_error_tmirkl_cdl_walk_err_first (mirkl_cdllist_t *List, mirkl_error_t *(*Func)(int, void *, void *), void *Args)
 
void mirkl_cdl_flwalk (mirkl_cdllist_t *List, void(*Func)(int, void *, void *), void *Args)
 Walking through the list and executing the user-supplied function with each of the nodes. More...
 
mirkl_error_tmirkl_cdl_flwalk_err_first (mirkl_cdllist_t *List, mirkl_error_t *(*Func)(int, void *, void *), void *Args)
 
mirkl_error_tmirkl_cdl_flwalk_err_or_ptr_first (mirkl_cdllist_t *List, mirkl_error_t *(*Func)(int, void *, void *, void **), void *Args, void **Ret)
 

Detailed Description

The idea of cached list is to hide from user all logic of caching and to provide only really occupied list nodes.

Function Documentation

◆ mirkl_cdl_add()

mirkl_error_t * mirkl_cdl_add ( mirkl_cdllist_t **  Item,
int  Tag,
void *  Object,
mirkl_cdllist_t **  newObj,
apr_pool_t *  pool 
)

Add an item to the list. Position of the new item in the list is implementation-dependent.

Warning
Use this function when it is not important, where the new item is added.

◆ mirkl_cdl_append()

mirkl_error_t * mirkl_cdl_append ( mirkl_cdllist_t **  list,
int  Tag,
void *  Object,
mirkl_cdllist_t **  newObj,
apr_pool_t *  pool 
)

Appends (i.e. adds to the end of the list) data to the list.

Warning
The code uses APR memory pools model. We allocate memory only from external pools. Caller knows better the lifetime of the list! The same is true for freeing of memory: here we only extract nodes. The actual memory frees only happen somewhere out of list logic where caller decide.
The function does not copy data. It just stores user-provided pointers to data.

◆ mirkl_cdl_flwalk()

void mirkl_cdl_flwalk ( mirkl_cdllist_t List,
void(*)(int, void *, void *)  Func,
void *  Args 
)

Walking through the list and executing the user-supplied function with each of the nodes.

Note
The mirkl_cdl_flwalk[_...] functions guarantee the first-to-last walking order. This is the only difference from the respective functions of the mirkl_cdl_walk family.

◆ mirkl_cdl_walk()

void mirkl_cdl_walk ( mirkl_cdllist_t List,
void(*)(int, void *, void *)  Func,
void *  Args 
)

Walking through the list and executing the user-supplied function with each of the nodes.

Parameters
[in]ListList to walk through.
[in]FuncFunction to be executed with each node.
[in]ArgsUser-defined arguments to be passed to the function Func.
Note
The walking order in the mirkl_cdl_walk set of functions is implementation-defined, i.e. it is not necessarily from first-to-last or from last-to-first! If you need guaranteed particular walking order use the mirkl_cdl_flwalk or mirkl_cdl_lfwalk family of functions.