ELinks 0.18.0
|
#include "util/error.h"
Data Structures | |
struct | list_head |
struct | xlist_head |
Macros | |
#define | LISTDEBUG |
Lists debugging. | |
#define | list_head list_head_elinks |
#define | LISTMAGIC1 ((void *) 0xdadababa) |
#define | LISTMAGIC2 ((void *) 0xd0d0b0b0) |
#define | LISTMAGIC3 ((void *) 0x25254545) |
#define | list_del_enforce(x) |
#define | list_magic_error(where, what) INTERNAL("[%s] %s - bad list magic", where, #what) |
#define | list_magic_set(x) |
#define | list_magic_correct(x) ((x).magic1 == LISTMAGIC1 && (x).magic2 == LISTMAGIC2) |
Backend for list_magic_check() and list_magic_chkbool(). | |
#define | list_magic_check(x, where) |
#define | list_magic_chkbool(x, where) (list_magic_correct(x) || (list_magic_error(where, x), 1)) |
#define | NULL_LIST_HEAD_EL LISTMAGIC1, NULL, NULL, LISTMAGIC2 |
#define | D_LIST_HEAD_EL(x) LISTMAGIC1, &x, &x, LISTMAGIC2 |
#define | LIST_HEAD_EL(x) void *magic1; x *next; x *prev; void *magic2 |
#define | LIST_SET_MAGIC(x) list_magic_set(*(x)) |
#define | LIST_OF(element_T) struct list_head |
A list intended to contain elements of a specific type. | |
#define | INIT_LIST_OF(element_T, x) LIST_OF(element_T) x = { D_LIST_HEAD_EL(x) } |
Define and initialize a list variable. | |
#define | list_typeof(x) struct xlist_head * |
#define | list_typeof2(x) void * |
#define | init_list(x) |
#define | list_empty(x) (list_magic_chkbool(x, "list_empty") && (x).next == &(x)) |
#define | list_is_singleton(x) (list_magic_chkbool(x, "list_is_singleton") && (x).next == (x).prev) |
#define | list_has_prev(l, p) (list_magic_chkbool(l, "list_has_prev") && (p)->prev != (void *) &(l)) |
#define | list_has_next(l, p) (list_magic_chkbool(l, "list_has_next") && (p)->next != (void *) &(l)) |
#define | del_from_list(x) |
#define | add_at_pos(p, x) |
#define | add_to_list(l, x) add_at_pos((list_typeof(x)) &(l), (list_typeof(x)) (x)) |
#define | add_to_list_end(l, x) add_at_pos((list_typeof(x)) (l).prev, (list_typeof(x)) (x)) |
#define | foreach(e, l) |
#define | foreachback(e, l) |
#define | foreachsafe(e, n, l) |
#define | foreachbacksafe(e, p, l) |
#define | free_list(l) |
#define | move_to_top_of_list(list, item) |
Functions | |
static int | list_size (struct list_head *list) |
#define add_at_pos | ( | p, | |
x ) |
#define add_to_list | ( | l, | |
x ) add_at_pos((list_typeof(x)) &(l), (list_typeof(x)) (x)) |
#define add_to_list_end | ( | l, | |
x ) add_at_pos((list_typeof(x)) (l).prev, (list_typeof(x)) (x)) |
#define D_LIST_HEAD_EL | ( | x | ) | LISTMAGIC1, &x, &x, LISTMAGIC2 |
#define del_from_list | ( | x | ) |
#define foreach | ( | e, | |
l ) |
#define foreachback | ( | e, | |
l ) |
#define foreachbacksafe | ( | e, | |
p, | |||
l ) |
#define foreachsafe | ( | e, | |
n, | |||
l ) |
#define free_list | ( | l | ) |
#define init_list | ( | x | ) |
#define INIT_LIST_OF | ( | element_T, | |
x ) LIST_OF(element_T) x = { D_LIST_HEAD_EL(x) } |
Define and initialize a list variable.
The element_T parameter currently serves as documentation only; the compiler does not check that it matches.
#define list_del_enforce | ( | x | ) |
#define list_empty | ( | x | ) | (list_magic_chkbool(x, "list_empty") && (x).next == &(x)) |
#define list_has_next | ( | l, | |
p ) (list_magic_chkbool(l, "list_has_next") && (p)->next != (void *) &(l)) |
#define list_has_prev | ( | l, | |
p ) (list_magic_chkbool(l, "list_has_prev") && (p)->prev != (void *) &(l)) |
#define list_head list_head_elinks |
#define LIST_HEAD_EL | ( | x | ) | void *magic1; x *next; x *prev; void *magic2 |
#define list_is_singleton | ( | x | ) | (list_magic_chkbool(x, "list_is_singleton") && (x).next == (x).prev) |
#define list_magic_check | ( | x, | |
where ) |
#define list_magic_chkbool | ( | x, | |
where ) (list_magic_correct(x) || (list_magic_error(where, x), 1)) |
#define list_magic_correct | ( | x | ) | ((x).magic1 == LISTMAGIC1 && (x).magic2 == LISTMAGIC2) |
Backend for list_magic_check() and list_magic_chkbool().
#define list_magic_set | ( | x | ) |
#define LIST_OF | ( | element_T | ) | struct list_head |
A list intended to contain elements of a specific type.
The element_T parameter currently serves as documentation only; the compiler does not check that it matches. Doxyfile defines this macro differently in order to get better collaboration diagrams.
#define LIST_SET_MAGIC | ( | x | ) | list_magic_set(*(x)) |
#define list_typeof | ( | x | ) | struct xlist_head * |
#define list_typeof2 | ( | x | ) | void * |
#define LISTDEBUG |
Lists debugging.
Two unsigned int magic number will be put before and after the next and prev pointers, these will be check on list operations. Some pointers are set to specific values after action.
#define LISTMAGIC1 ((void *) 0xdadababa) |
#define LISTMAGIC2 ((void *) 0xd0d0b0b0) |
#define LISTMAGIC3 ((void *) 0x25254545) |
#define move_to_top_of_list | ( | list, | |
item ) |
#define NULL_LIST_HEAD_EL LISTMAGIC1, NULL, NULL, LISTMAGIC2 |
|
inlinestatic |