![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
List structures and definitions. More...
#include <stdio.h>#include <stdlib.h>
Include dependency graph for n_list.h:
This graph shows which files directly or indirectly include this file: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, with NULL safety. | |
| #define | list_foreach(__ITEM_, __LIST_) |
| ForEach macro helper, safe for node removal during iteration. | |
| #define | list_pop(__LIST_, __TYPE_) (__TYPE_*)list_pop_f(__LIST_) |
| Pop macro helper for void pointer casting. | |
| #define | list_shift(__LIST_, __TYPE_) (__TYPE_*)list_shift_f(__LIST_, __FILE__, __LINE__) |
| Shift macro helper for void pointer casting. | |
| #define | MAX_LIST_ITEMS SIZE_MAX |
| flag to pass to new_generic_list for the maximum possible number of item in a list | |
| #define | remove_list_node(__LIST_, __NODE_, __TYPE_) (__TYPE_*)remove_list_node_f(__LIST_, __NODE_) |
| Remove macro helper for void pointer casting. | |
| #define | UNLIMITED_LIST_ITEMS 0 |
| flag to pass to new_generic_list for an unlimited number of item in the list. | |
Functions | |
| int | list_destroy (LIST **list) |
| free the list | |
| int | list_empty (LIST *list) |
| empty the list | |
| int | list_empty_with_f (LIST *list, void(*free_fnct)(void *ptr)) |
| empty the list with a custom free function | |
| LIST_NODE * | list_node_pop (LIST *list) |
| pop a node from the end of the list | |
| int | list_node_push (LIST *list, LIST_NODE *node) |
| push a node at the end of the list | |
| LIST_NODE * | list_node_shift (LIST *list) |
| shift a node from the beginning of the list | |
| int | list_node_unshift (LIST *list, LIST_NODE *node) |
| unshift a node at the beginning of the list | |
| void * | list_pop_f (LIST *list) |
| get last ptr from list | |
| int | list_push (LIST *list, void *ptr, void(*destructor)(void *ptr)) |
| add a pointer at the end of the list | |
| int | list_push_sorted (LIST *list, void *ptr, int(*comparator)(const void *a, const void *b), void(*destructor)(void *ptr)) |
| add a pointer sorted via comparator from the end of the list | |
| LIST_NODE * | list_search (LIST *list, const void *ptr) |
| search ptr in list | |
| LIST_NODE * | list_search_with_f (LIST *list, int(*checkfunk)(void *ptr)) |
| search for data in list | |
| void * | list_shift_f (LIST *list, char *file, size_t line) |
| get first ptr from list | |
| int | list_unshift (LIST *list, void *ptr, void(*destructor)(void *ptr)) |
| put a pointer at the beginning of list | |
| int | list_unshift_sorted (LIST *list, void *ptr, int(*comparator)(const void *a, const void *b), void(*destructor)(void *ptr)) |
| put a pointer sorted via comparator from the start to the end | |
| LIST * | new_generic_list (size_t max_items) |
| initialize a list | |
| LIST_NODE * | new_list_node (void *ptr, void(*destructor)(void *ptr)) |
| create a new node | |
| void * | remove_list_node_f (LIST *list, LIST_NODE *node) |
| remove a node | |