110 int (*condition) (
void *));
118 void (*action) (
void *));
127 void (*action) (
void *,
void *),
void *arg);
167 uint64_t local_n = n + 1;
181 return (
void *) ((
char *)tmp->
p_payload + applied_offset);
257 return (
void *) ((
char *)tmp->
p_payload + applied_offset);
314 if( list->
list == NULL )
341 if( source->
list == NULL )
344 if( dest->
list == NULL )
357 if( list->
list == NULL || list->
count == 0 )
371 if( list->
list == NULL || list->
count == 0)
385 if( list->
list == NULL || list->
count == 0)
418 if( list->
list == NULL )
struct chained_list * chained_list_alloc_next_chunk(struct chained_list *current_chunk)
Alocate a new chunk pointing to current_chunk (Recopy MODE )
int chained_list_count(struct chained_list *list)
Count elements in the chained list.
This struct is used to improve performance when sequentially walking through.
void * chained_list_push(struct chained_list **list, void *p_payload)
Push an element in the chained list.
Basic buffered chained list.
void chained_list_release(struct chained_list **list)
Release a buffered chained list.
static void * chained_list_get_nth(struct chained_list *list, uint64_t n)
Get a reference to the nth element of the chained list.
static void chained_list_view_init(struct chained_list_view *clv)
Initializes a chained_list_view.
size_t size_of_payload
Size of the payload.
size_t payload_size
the size of elements that can be stored in the list
static void * Chained_List_get_nth(struct Chained_List *list, uint64_t n)
Gets the nth element of the list.
static void Chained_List_cond_merge(struct Chained_List *dest, struct Chained_List *source, int(*condition)(void *))
Push all element of source satisfying condition in dest.
uint64_t count
the number of elements in the list
struct chained_list * last_chunk
the chunk containing last element
void chained_list_walkthrough_arg(struct chained_list *list, void(*action)(void *, void *), void *arg)
Call a function uppon each element of the chained list.
static void Chained_List_init(struct Chained_List *list, uint64_t chunk_size, size_t payload_size)
Initializes a Chained_List.
static uint64_t Chained_List_count(struct Chained_List *list)
Counts the elements in the list.
struct chained_list * p_prev
previous trunk
struct chained_list * list
the head chained_list chunk
This a structure wrapps the use of chained_list This is the main chain list structure to use...
static void * Chained_List_push(struct Chained_List *list, void *payload)
Adds an element to the list.
static void Chained_List_walkthrough(struct Chained_List *list, void(*action)(void *))
Call a function uppon each element of the chained list.
void * chained_list_get_elem(struct chained_list *list, int(*test_func)(void *, void *), void *value)
Get a pointer to the first element which matches a value.
void chained_list_walkthrough(struct chained_list *list, void(*action)(void *))
Call a function uppon each element of the chained list.
void * p_payload
payload array of trunk
uint64_t last_chunk_offset
the offset of last element in last chunk
void cond_chained_list_merge(struct chained_list **dest, struct chained_list *source, int(*condition)(void *))
Push all element of source satisfying condition in dest.
uint32_t current_offset
Current offset in trunk.
uint64_t chunk_size
the size of the chunks
struct chained_list * chained_list_init(uint32_t size_of_trunk, size_t size_of_payload)
Ininitalizes a buffered chained list.
struct chained_list * chained_list_alloc_chunk(uint32_t size_of_trunk, size_t size_of_payload)
Alocate a new chunk ( first chunk )
uint32_t size_of_trunk
Size of a trunk.
static void Chained_List_release(struct Chained_List *list)
Clears a Chained_List.
static void * chained_list_get_nth_seq(struct chained_list *list, struct chained_list_view *view, uint64_t n)
Get a reference to the nth element of the chained list (optimised for sequential) ...
static void Chained_List_walkthrough_arg(struct Chained_List *list, void(*action)(void *, void *), void *arg)
Call a function uppon each element of the chained list.
static void * Chained_List_get_elem(struct Chained_List *list, int(*test_func)(void *, void *), void *value)
Get a pointer to the first element which matches a value.
static void * Chained_List_get_nth_seq(struct Chained_List *cl, struct chained_list_view *view, uint64_t n)
Get a reference to the nth element of the chained list (optimised for sequential) ...