libusual
0.1
|
Circular list for shared mem. More...
Data Structures | |
struct | SHList |
List node/head. More... | |
Defines | |
#define | shlist_pop_type(list, type, field) |
Remove and return specific type of elem. | |
#define | shlist_for_each(node, list) |
Loop over list. | |
#define | shlist_for_each_safe(node, list, tmp) |
Loop over list and allow removing node. | |
Functions | |
static struct SHList * | shlist_get_next (const struct SHList *node) |
Get next element in list. | |
static struct SHList * | shlist_get_prev (const struct SHList *node) |
Get prev element in list. | |
static void | shlist_init (struct SHList *list) |
Initialize list head. | |
static void | shlist_append (struct SHList *list, struct SHList *node) |
Insert as last element. | |
static void | shlist_prepend (struct SHList *list, struct SHList *node) |
Insert as first element. | |
static void | shlist_remove (struct SHList *node) |
Remove an node. | |
static bool | shlist_empty (const struct SHList *list) |
No elements? | |
static struct SHList * | shlist_first (const struct SHList *list) |
Return first elem. | |
static struct SHList * | shlist_last (const struct SHList *list) |
Return last elem. | |
static struct SHList * | shlist_pop (struct SHList *list) |
Remove first elem. |
Circular list for shared mem.
Instead of pointers, it uses offsets from list head.
#define shlist_pop_type | ( | list, | |
type, | |||
field | |||
) |
Remove and return specific type of elem.
#define shlist_for_each | ( | node, | |
list | |||
) |
Loop over list.
#define shlist_for_each_safe | ( | node, | |
list, | |||
tmp | |||
) |
Loop over list and allow removing node.
static struct SHList* shlist_get_next | ( | const struct SHList * | node | ) | [static, read] |
Get next element in list.
Referenced by shlist_first(), shlist_prepend(), and shlist_remove().
static struct SHList* shlist_get_prev | ( | const struct SHList * | node | ) | [static, read] |
Get prev element in list.
Referenced by shlist_append(), shlist_last(), and shlist_remove().
static void shlist_init | ( | struct SHList * | list | ) | [inline, static] |
Initialize list head.
Referenced by shlist_remove().
static void shlist_append | ( | struct SHList * | list, |
struct SHList * | node | ||
) | [inline, static] |
Insert as last element.
References shlist_get_prev().
static void shlist_prepend | ( | struct SHList * | list, |
struct SHList * | node | ||
) | [inline, static] |
Insert as first element.
References shlist_get_next().
static void shlist_remove | ( | struct SHList * | node | ) | [inline, static] |
Remove an node.
References shlist_get_next(), shlist_get_prev(), and shlist_init().
Referenced by shlist_pop().
static bool shlist_empty | ( | const struct SHList * | list | ) | [inline, static] |
No elements?
Referenced by shlist_first(), and shlist_last().
static struct SHList* shlist_first | ( | const struct SHList * | list | ) | [static, read] |
static struct SHList* shlist_last | ( | const struct SHList * | list | ) | [static, read] |
Return last elem.
References shlist_empty(), and shlist_get_prev().
static struct SHList* shlist_pop | ( | struct SHList * | list | ) | [static, read] |
Remove first elem.
References shlist_first(), and shlist_remove().