Elements may be added at any arbitrary location in the linked list with ll_add(); moved to any other arbitrary location in the linked list with ll_move(); or removed from the list with ll_remove(). In addition, the user may search the list using a user-defined comparison function with ll_find(); iterate over every element in the list with ll_iter(); or remove all items from the list with ll_flush(), optionally executing a user-specified clean-up function.
Data Structures | |
struct | _link_head_s |
Linked list head structure. More... | |
struct | _link_elem_s |
Linked list element structure. More... | |
Defines | |
#define | LINK_HEAD_MAGIC |
Linked list head magic number. | |
#define | LINK_HEAD_INIT(extra) |
Linked list head static initializer. | |
#define | ll_verify(list) |
Linked list head verification macro. | |
#define | ll_count(list) |
Linked list count. | |
#define | ll_first(list) |
First element in linked list. | |
#define | ll_last(list) |
Last element in a linked list. | |
#define | ll_extra(list) |
Extra pointer data in a linked list. | |
#define | LINK_ELEM_MAGIC |
Linked list element magic number. | |
#define | LINK_ELEM_INIT(obj) |
Linked list element static initializer. | |
#define | le_verify(element) |
Linked list element verification macro. | |
#define | le_next(elem) |
Linked list element next pointer. | |
#define | le_prev(elem) |
Linked list element previous pointer. | |
#define | le_object(elem) |
Linked list element object pointer. | |
#define | le_head(elem) |
Linked list element head pointer. | |
#define | le_flags(elem) |
Linked list element flags. | |
Typedefs | |
typedef _link_head_s | link_head_t |
Linked list head. | |
typedef _link_elem_s | link_elem_t |
Linked list element. | |
typedef unsigned long(* | link_iter_t )(link_head_t *list, link_elem_t *elem, void *extra) |
Linked list iteration callback. | |
typedef unsigned long(* | link_comp_t )(db_key_t *key, void *obj) |
Linked list comparison callback. | |
typedef enum _link_loc_e | link_loc_t |
Linked list location. | |
Enumerations | |
enum | _link_loc_e { LINK_LOC_HEAD, LINK_LOC_TAIL, LINK_LOC_BEFORE, LINK_LOC_AFTER } |
Linked list location. More... | |
Functions | |
unsigned long | ll_init (link_head_t *list, void *extra) |
Dynamically initialize a linked list head. | |
unsigned long | ll_add (link_head_t *list, link_elem_t *new, link_loc_t loc, link_elem_t *elem) |
Add an element to a linked list. | |
unsigned long | ll_move (link_head_t *list, link_elem_t *elem, link_loc_t loc, link_elem_t *elem2) |
Move an element within a linked list. | |
unsigned long | ll_remove (link_head_t *list, link_elem_t *elem) |
Remove an element from a linked list. | |
unsigned long | ll_find (link_head_t *list, link_elem_t **elem_p, link_comp_t comp_func, link_elem_t *start, db_key_t *key) |
Find an element in a linked list. | |
unsigned long | ll_iter (link_head_t *list, link_elem_t *start, link_iter_t iter_func, void *extra, unsigned long flags) |
Iterate over each entry in a linked list. | |
unsigned long | ll_flush (link_head_t *list, link_iter_t flush_func, void *extra) |
Flush a linked list. | |
unsigned long | le_init (link_elem_t *elem, void *object) |
Dynamically initialize a linked list element. |
|
This macro retrieves a set of user-defined flags associated with the element. It may be used as an lvalue to set those flags.
|
|
This macro retrieves a pointer to the head of the linked list that the element is in.
|
|
This macro retrieves a pointer to the next element in the linked list.
|
|
This macro retrieves a pointer to the object represented by the element. It may be used as an lvalue to change the object pointed to. Care should be taken when using this feature.
Definition at line 977 of file dbprim.h. Referenced by _sh_flush_iter(), _sh_iter_iter(), _smat_alloc(), _smat_free(), ht_add(), ht_find(), ht_flush(), ht_iter(), ht_resize(), sh_find(), and smat_cleanup(). |
|
This macro retrieves a pointer to the previous element in the linked list.
|
|
This macro verifies that a given pointer actually does point to a linked list element.
Definition at line 936 of file dbprim.h. Referenced by ll_add(), ll_find(), ll_iter(), ll_move(), and ll_remove(). |
|
This macro statically initializes a link_elem_t.
|
|
For internal use only. This is the magic number used for the linked list element structure. Definition at line 911 of file dbprim.h. Referenced by le_init(). |
|
This macro statically initializes a link_head_t.
|
|
For internal use only. This is the magic number used for the linked list head structure. Definition at line 651 of file dbprim.h. Referenced by ll_init(). |
|
This macro retrieves the number of elements in a linked list.
Definition at line 689 of file dbprim.h. Referenced by _smat_alloc(), and smat_freemem(). |
|
This macro retrieves the extra pointer data associated with a particular linked list.
|
|
This macro retrieves the first element in a linked list.
Definition at line 700 of file dbprim.h. Referenced by _smat_alloc(), ht_find(), ht_flush(), ht_iter(), ht_resize(), and smat_cleanup(). |
|
This macro retrieves the last element in a linked list.
|
|
This macro verifies that a given pointer actually does point to a linked list head.
Definition at line 676 of file dbprim.h. Referenced by ll_add(), ll_find(), ll_flush(), ll_iter(), ll_move(), and ll_remove(). |
|
This function pointer references a callback used by ll_find(). It should return 0 if the entry passed as the second argument matches the key passed as the first argument.
|
|
This structure represents a single element of a linked list. |
|
This structure is the head of all linked lists maintained by this library. |
|
This function pointer references a callback used by ll_iter() and ll_flush(). It should return 0 for success. A non-zero return value will terminate the operation and will become the return value of the ll_iter() or ll_flush() call.
|
|
See the documentation for the enumeration _link_loc_e. |
|
This enumeration is used to specify where an element in a linked list should be placed. It should be referenced by the typedef link_loc_t. |
|
This function dynamically initializes a linked list element.
Definition at line 34 of file le_init.c. References _link_elem_s::le_flags, _link_elem_s::le_head, _link_elem_s::le_magic, _link_elem_s::le_next, _link_elem_s::le_object, _link_elem_s::le_prev, and LINK_ELEM_MAGIC. Referenced by _smat_alloc(), and he_init(). |
|
This function adds a given element to a specified linked list in the specified location.
Definition at line 34 of file ll_add.c. References _link_elem_s::le_head, _link_elem_s::le_next, _link_elem_s::le_prev, le_verify, _link_head_s::lh_count, _link_head_s::lh_first, _link_head_s::lh_last, LINK_LOC_AFTER, LINK_LOC_BEFORE, LINK_LOC_HEAD, LINK_LOC_TAIL, and ll_verify. Referenced by _smat_free(), ht_add(), ht_move(), ht_resize(), and st_add(). |
|
This function iterates through a linked list looking for an element that matches the given
Definition at line 34 of file ll_find.c. References _link_elem_s::le_head, _link_elem_s::le_next, _link_elem_s::le_object, le_verify, _link_head_s::lh_first, and ll_verify. Referenced by sh_find(). |
|
This function flushes a linked list--that is, it removes each element from the list. If a
Definition at line 34 of file ll_flush.c. References _link_head_s::lh_count, _link_head_s::lh_first, _link_head_s::lh_last, ll_remove(), and ll_verify. Referenced by sh_flush(). Here is the call graph for this function: ![]() |
|
This function dynamically initializes a linked list head.
Definition at line 34 of file ll_init.c. References _link_head_s::lh_count, _link_head_s::lh_extra, _link_head_s::lh_first, _link_head_s::lh_last, _link_head_s::lh_magic, and LINK_HEAD_MAGIC. Referenced by ht_init(), ht_resize(), and sh_init(). |
|
This function iterates over a linked list, executing the given
Definition at line 34 of file ll_iter.c. References DB_FLAG_REVERSE, _link_elem_s::le_head, _link_elem_s::le_next, _link_elem_s::le_prev, le_verify, _link_head_s::lh_first, _link_head_s::lh_last, and ll_verify. Referenced by sh_iter(). |
|
This function moves a specified element within the linked list.
Definition at line 35 of file ll_move.c. References _link_elem_s::le_head, _link_elem_s::le_next, _link_elem_s::le_prev, le_verify, _link_head_s::lh_first, _link_head_s::lh_last, LINK_LOC_AFTER, LINK_LOC_BEFORE, LINK_LOC_HEAD, LINK_LOC_TAIL, and ll_verify. Referenced by sh_move(). |
|
This function removes a specified element from a linked list.
Definition at line 34 of file ll_remove.c. References _link_elem_s::le_head, _link_elem_s::le_next, _link_elem_s::le_prev, le_verify, _link_head_s::lh_count, _link_head_s::lh_first, _link_head_s::lh_last, and ll_verify. Referenced by _smat_alloc(), _st_remove(), ht_move(), ht_remove(), ht_resize(), ll_flush(), smat_cleanup(), and st_add(). |