vlist: add static initializer macros
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
parent
411d10c845
commit
949f0d00bf
1 changed files with 13 additions and 0 deletions
13
vlist.h
13
vlist.h
|
@ -41,6 +41,19 @@ struct vlist_node {
|
||||||
int version;
|
int version;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define VLIST_TREE_INIT(_name, _comp, _update, _keep_old, _no_delete) \
|
||||||
|
{ \
|
||||||
|
.avl = AVL_TREE_INIT(_name.avl, _comp, false, NULL), \
|
||||||
|
.update = _update, \
|
||||||
|
.version = 1, \
|
||||||
|
.keep_old = _keep_old, \
|
||||||
|
.no_delete = _no_delete, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VLIST_TREE(_name, ...) \
|
||||||
|
struct vlist_tree _name = \
|
||||||
|
VLIST_TREE_INIT(_name, __VA_ARGS__)
|
||||||
|
|
||||||
void vlist_init(struct vlist_tree *tree, avl_tree_comp cmp, vlist_update_cb update);
|
void vlist_init(struct vlist_tree *tree, avl_tree_comp cmp, vlist_update_cb update);
|
||||||
|
|
||||||
#define vlist_find(tree, name, element, node_member) \
|
#define vlist_find(tree, name, element, node_member) \
|
||||||
|
|
Loading…
Reference in a new issue