Nilorea Library
C utilities for networking, threading, graphics
|
List structures and definitions. More...
#include "stdio.h"
#include "stdlib.h"
Go to the source code of this file.
Data Structures | |
struct | LIST |
Structure of a generic LIST container. More... | |
struct | LIST_NODE |
Structure of a generic list node. More... | |
Macros | |
#define | link_node(__NODE_1, __NODE_2) |
Macro helper for linking two nodes. More... | |
#define | list_foreach(__ITEM_, __LIST_) |
ForEach macro helper. More... | |
#define | list_pop(__LIST_, __TYPE_) ( __TYPE_ *)list_pop_f( __LIST_ ) |
Pop macro helper for void pointer casting. More... | |
#define | list_shift(__LIST_, __TYPE_) (__TYPE_ *)list_shift_f( __LIST_ ) |
Shift macro helper for void pointer casting. More... | |
#define | remove_list_node(__LIST_, __NODE_, __TYPE_) (__TYPE_ *)remove_list_node_f( __LIST_ , __NODE_ ) |
Remove macro helper for void pointer casting. More... | |
Functions | |
int | list_destroy (LIST **list) |
Empty and Free a list container. More... | |
int | list_empty (LIST *list) |
Empty a LIST list of pointers. More... | |
int | list_empty_with_f (LIST *list, void(*free_fnct)(void *ptr)) |
Empty a LIST list of pointers. More... | |
LIST_NODE * | list_node_pop (LIST *list) |
Get a LIST_NODE pointer from the end of the list. More... | |
int | list_node_push (LIST *list, LIST_NODE *node) |
Add a filled node to the end of the list. More... | |
LIST_NODE * | list_node_shift (LIST *list) |
Get a LIST_NODE pointer from the start of the list. More... | |
int | list_node_unshift (LIST *list, LIST_NODE *node) |
Add a pointer at the start of the list. More... | |
void * | list_pop_f (LIST *list) |
Get a pointer from the end of the list. More... | |
int | list_push (LIST *list, void *ptr, void(*destructor)(void *ptr)) |
Add a pointer to the end of the list. More... | |
int | list_push_sorted (LIST *list, void *ptr, int(*comparator)(const void *a, const void *b), void(*destructor)(void *ptr)) |
Add a pointer sorted in the list , starting by the end of the list. More... | |
LIST_NODE * | list_search (LIST *list, void *ptr) |
search ptr in list More... | |
LIST_NODE * | list_search_with_f (LIST *list, int(*checkfunk)(void *ptr)) |
search ptr in list More... | |
void * | list_shift_f (LIST *list) |
Get a pointer from the start of the list. More... | |
int | list_unshift (LIST *list, void *ptr, void(*destructor)(void *ptr)) |
Add a pointer at the start of the list. More... | |
int | list_unshift_sorted (LIST *list, void *ptr, int(*comparator)(const void *a, const void *b), void(*destructor)(void *ptr)) |
Add a pointer sorted in the list , starting by the start of the list. More... | |
LIST * | new_generic_list (int max_items) |
Initialiaze a generic list container to max_items pointers. More... | |
LIST_NODE * | new_list_node (void *ptr, void(*destructor)(void *ptr)) |
Allocate a new node to link in a list. More... | |
void * | remove_list_node_f (LIST *list, LIST_NODE *node) |
Internal function called each time we need to get a node out of a list. More... | |