Go to the source code of this file.
Data Structures | |
struct | List_ |
This structure defines a linked list. More... | |
struct | ListElmt_ |
This structure defines one element of the linked list. More... | |
Defines | |
#define | list_size(liste) ((liste)->taille) |
Return the number of elements in a linked list. | |
#define | list_head(liste) ((liste)->tete) |
Return a pointer to the first element of the linked list. | |
#define | list_tail(liste) ((liste)->queue) |
Return a pointer to the last element of the linked list. | |
#define | list_is_head(liste, element) ((element) == (liste)->tete ? 1 : 0) |
Test if a given element is the first element of a linked list. | |
#define | list_is_tail(element) ((element)->suivant == NULL ? 1 : 0) |
Test if a given element is the last element of a linked list. | |
#define | list_data(element) ((element)->donnee) |
Return a pointer to the data hold by an element. | |
#define | list_next(element) ((element)->suivant) |
Return a pointer to the next element in the linked list. | |
Typedefs | |
typedef ListElmt_ | ListElmt |
This structure defines one element of the linked list. | |
typedef List_ | List |
This structure defines a linked list. | |
Functions | |
void | list_init (List *liste, void(*detruire)(void *donnee), int(*corresp)(const void *val1, const void *val2)) |
Initialize the linked list. This function should be called first. | |
void | list_destroy (List *liste) |
Destroy the linked list. This function free all allocated memory used by the list. | |
int | list_ins_next (List *liste, ListElmt *element, const void *donnee) |
Insert a new element into the linked list. | |
int | list_rem_next (List *liste, ListElmt *element, void **donnee) |
Remove an element from the linked list. | |
ListElmt * | list_find (List *liste, ListElmt *from, void *data, ListElmt **prec) |
Search an element into the linked list. |
Definition in file list.h.
|
Return a pointer to the data hold by an element.
Definition at line 117 of file list.h. Referenced by chtbl_find(), chtbl_lookup(), chtbl_next(), and list_find(). |
|
Return a pointer to the first element of the linked list.
Definition at line 88 of file list.h. Referenced by chtbl_find(), chtbl_lookup(), chtbl_next(), and list_find(). |
|
Test if a given element is the first element of a linked list.
|
|
Test if a given element is the last element of a linked list.
|
|
Return a pointer to the next element in the linked list.
Definition at line 124 of file list.h. Referenced by chtbl_find(), chtbl_lookup(), chtbl_next(), and list_find(). |
|
Return the number of elements in a linked list.
Definition at line 82 of file list.h. Referenced by list_destroy(), list_ins_next(), and list_rem_next(). |
|
Return a pointer to the last element of the linked list.
|
|
Destroy the linked list. This function free all allocated memory used by the list.
Definition at line 40 of file list.c. References List_::detruire, list_rem_next(), and list_size. Referenced by chtbl_destroy(). |
|
Search an element into the linked list.
Definition at line 231 of file list.c. References List_::corresp, list_data, list_head, and list_next. Referenced by chtbl_remove(). |
|
Initialize the linked list. This function should be called first.
Definition at line 21 of file list.c. References List_::corresp, List_::detruire, List_::queue, List_::taille, and List_::tete. Referenced by chtbl_init(). |
|
Insert a new element into the linked list.
Definition at line 69 of file list.c. References ListElmt_::donnee, list_size, List_::queue, ListElmt_::suivant, List_::taille, and List_::tete. Referenced by chtbl_insert(), and stack_push(). |
|
Remove an element from the linked list.
Definition at line 145 of file list.c. References ListElmt_::donnee, list_size, List_::queue, ListElmt_::suivant, List_::taille, and List_::tete. Referenced by chtbl_remove(), list_destroy(), and stack_pop(). |