mbgtools-lx
4.2.8
|
#include <mbg_cof.h>
Go to the source code of this file.
Data Structures | |
struct | mbg_klist_head |
Macros | |
#define | _ext extern |
#define | MBG_KLIST_INIT(name) { &(name), &(name) } |
#define | MBG_KLIST_DECLARE(name) struct mbg_klist_head name = MBG_KLIST_INIT(name) |
#define | mbg_klist_for_each(head, pos) for (pos = (head)->next; pos != (head); pos = pos->next) |
#define | mbg_klist_for_each_safe(head, pos, n) |
#define | mbg_klist_for_each_rev(head, pos) for (pos = (head)->prev; pos != (head); pos = pos->prev) |
#define | mbg_klist_for_each_rev_safe(head, pos, n) |
#define | mbg_klist_nth_item(head, pos, n) |
#define | mbg_klist_entry(ptr, type, member) mbg_container_of(ptr, type, member) |
#define | mbg_klist_first_entry(ptr, type, member) mbg_klist_entry((ptr)->next, type, member) |
#define | mbg_klist_last_entry(ptr, type, member) mbg_klist_entry((ptr)->prev, type, member) |
Functions | |
static __mbg_inline void | mbg_klist_init (struct mbg_klist_head *head) |
static __mbg_inline void | __mbg_klist_add_item (struct mbg_klist_head *item, struct mbg_klist_head *prev, struct mbg_klist_head *next) |
static __mbg_inline void | mbg_klist_prepend_item (struct mbg_klist_head *head, struct mbg_klist_head *item) |
static __mbg_inline void | mbg_klist_append_item (struct mbg_klist_head *head, struct mbg_klist_head *item) |
static __mbg_inline void | __mbg_klist_delete_item (struct mbg_klist_head *prev, struct mbg_klist_head *next) |
static __mbg_inline void | mbg_klist_delete_item (struct mbg_klist_head *item) |
static __mbg_inline void | mbg_klist_delete_item_init (struct mbg_klist_head *item) |
static __mbg_inline void | mbg_klist_replace_item (struct mbg_klist_head *old, struct mbg_klist_head *item) |
static __mbg_inline void | mbg_klist_replace_item_init (struct mbg_klist_head *old, struct mbg_klist_head *item) |
static __mbg_inline void | mbg_klist_move_prepend_item (struct mbg_klist_head *head, struct mbg_klist_head *item) |
static __mbg_inline void | mbg_klist_move_append_item (struct mbg_klist_head *head, struct mbg_klist_head *item) |
static __mbg_inline int | mbg_klist_is_first (const struct mbg_klist_head *head, const struct mbg_klist_head *item) |
static __mbg_inline int | mbg_klist_is_last (const struct mbg_klist_head *head, const struct mbg_klist_head *item) |
static __mbg_inline int | mbg_klist_is_empty (const struct mbg_klist_head *head) |
static __mbg_inline void | __mbg_klist_add_list (const struct mbg_klist_head *list, struct mbg_klist_head *prev, struct mbg_klist_head *next) |
static __mbg_inline void | mbg_klist_prepend_list (struct mbg_klist_head *head, const struct mbg_klist_head *list) |
static __mbg_inline void | mbg_klist_append_list (struct mbg_klist_head *head, const struct mbg_klist_head *list) |
static __mbg_inline void | mbg_klist_prepend_list_init (struct mbg_klist_head *head, struct mbg_klist_head *list) |
static __mbg_inline void | mbg_klist_append_list_init (struct mbg_klist_head *head, struct mbg_klist_head *list) |
void | mbg_klist_sort (void *priv, struct mbg_klist_head *head, int(*cmp)(void *priv, struct mbg_klist_head *a, struct mbg_klist_head *b)) |
Sort a list. More... | |
#define _ext extern |
Definition at line 39 of file mbgklist.h.
#define MBG_KLIST_DECLARE | ( | name | ) | struct mbg_klist_head name = MBG_KLIST_INIT(name) |
Definition at line 52 of file mbgklist.h.
#define mbg_klist_entry | ( | ptr, | |
type, | |||
member | |||
) | mbg_container_of(ptr, type, member) |
Definition at line 77 of file mbgklist.h.
#define mbg_klist_first_entry | ( | ptr, | |
type, | |||
member | |||
) | mbg_klist_entry((ptr)->next, type, member) |
Definition at line 80 of file mbgklist.h.
Referenced by free_all_ucap_info(), and mbg_get_all_ucap_info().
#define mbg_klist_for_each | ( | head, | |
pos | |||
) | for (pos = (head)->next; pos != (head); pos = pos->next) |
Definition at line 55 of file mbgklist.h.
#define mbg_klist_for_each_rev | ( | head, | |
pos | |||
) | for (pos = (head)->prev; pos != (head); pos = pos->prev) |
Definition at line 63 of file mbgklist.h.
#define mbg_klist_for_each_rev_safe | ( | head, | |
pos, | |||
n | |||
) |
Definition at line 66 of file mbgklist.h.
#define mbg_klist_for_each_safe | ( | head, | |
pos, | |||
n | |||
) |
Definition at line 58 of file mbgklist.h.
#define MBG_KLIST_INIT | ( | name | ) | { &(name), &(name) } |
Definition at line 50 of file mbgklist.h.
#define mbg_klist_last_entry | ( | ptr, | |
type, | |||
member | |||
) | mbg_klist_entry((ptr)->prev, type, member) |
Definition at line 83 of file mbgklist.h.
#define mbg_klist_nth_item | ( | head, | |
pos, | |||
n | |||
) |
Definition at line 71 of file mbgklist.h.
|
static |
Definition at line 139 of file mbgklist.h.
References mbg_klist_head::next, and mbg_klist_head::prev.
Referenced by mbg_klist_append_item(), and mbg_klist_prepend_item().
|
static |
Definition at line 241 of file mbgklist.h.
References mbg_klist_head::next, and mbg_klist_head::prev.
Referenced by mbg_klist_append_list(), mbg_klist_append_list_init(), mbg_klist_prepend_list(), and mbg_klist_prepend_list_init().
|
static |
Definition at line 163 of file mbgklist.h.
References mbg_klist_head::next, and mbg_klist_head::prev.
Referenced by mbg_klist_delete_item(), and mbg_klist_delete_item_init().
|
static |
Definition at line 156 of file mbgklist.h.
References __mbg_klist_add_item(), and mbg_klist_head::prev.
Referenced by mbg_get_all_ucap_info(), and mbg_klist_move_append_item().
|
static |
Definition at line 263 of file mbgklist.h.
References __mbg_klist_add_list(), mbg_klist_is_empty(), and mbg_klist_head::prev.
|
static |
Definition at line 282 of file mbgklist.h.
References __mbg_klist_add_list(), mbg_klist_init(), mbg_klist_is_empty(), mbg_klist_sort(), and mbg_klist_head::prev.
|
static |
Definition at line 171 of file mbgklist.h.
References __mbg_klist_delete_item(), mbg_klist_head::next, and mbg_klist_head::prev.
Referenced by free_all_ucap_info(), mbg_get_all_ucap_info(), mbg_klist_move_append_item(), and mbg_klist_move_prepend_item().
|
static |
Definition at line 178 of file mbgklist.h.
References __mbg_klist_delete_item(), mbg_klist_init(), mbg_klist_head::next, and mbg_klist_head::prev.
|
static |
Definition at line 131 of file mbgklist.h.
References mbg_klist_head::next, and mbg_klist_head::prev.
Referenced by calloc_ucap_entry(), mbg_get_all_ucap_info(), mbg_klist_append_list_init(), mbg_klist_delete_item_init(), mbg_klist_prepend_list_init(), and mbg_klist_replace_item_init().
|
static |
Definition at line 234 of file mbgklist.h.
References mbg_klist_head::next.
Referenced by free_all_ucap_info(), mbg_klist_append_list(), mbg_klist_append_list_init(), mbg_klist_prepend_list(), and mbg_klist_prepend_list_init().
|
static |
Definition at line 220 of file mbgklist.h.
References mbg_klist_head::prev.
|
static |
Definition at line 227 of file mbgklist.h.
References mbg_klist_head::next.
|
static |
Definition at line 212 of file mbgklist.h.
References mbg_klist_append_item(), and mbg_klist_delete_item().
|
static |
Definition at line 204 of file mbgklist.h.
References mbg_klist_delete_item(), and mbg_klist_prepend_item().
|
static |
Definition at line 149 of file mbgklist.h.
References __mbg_klist_add_item(), and mbg_klist_head::next.
Referenced by mbg_klist_move_prepend_item().
|
static |
Definition at line 255 of file mbgklist.h.
References __mbg_klist_add_list(), mbg_klist_is_empty(), and mbg_klist_head::next.
|
static |
Definition at line 271 of file mbgklist.h.
References __mbg_klist_add_list(), mbg_klist_init(), mbg_klist_is_empty(), and mbg_klist_head::next.
|
static |
Definition at line 186 of file mbgklist.h.
References mbg_klist_head::next, and mbg_klist_head::prev.
Referenced by mbg_klist_replace_item_init().
|
static |
Definition at line 196 of file mbgklist.h.
References mbg_klist_init(), and mbg_klist_replace_item().
void mbg_klist_sort | ( | void * | priv, |
struct mbg_klist_head * | head, | ||
int(*)(void *priv, struct mbg_klist_head *a, struct mbg_klist_head *b) | cmp | ||
) |
Sort a list.
[in] | priv | Private data, opaque to mbg_klist_sort, passed to cmp |
[in] | head | The list to sort |
[in] | cmp | The elements comparison function |
This function implements "merge sort", which has O(nlog(n)) complexity.
The comparison function cmp
must return a negative value if a should sort before b, and a positive value if a should sort after b. If a and b are equivalent, and their original relative ordering is to be preserved, cmp must return 0.
Referenced by mbg_klist_append_list_init().