Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-06-05 17:28:45 +0400
committerFelix Fietkau <nbd@openwrt.org>2014-06-05 17:28:45 +0400
commit949f0d00bf12c90dcf4acc8479da184f1cd81673 (patch)
treeb5dacff9d12d1d39d5b53407c7d2807e3f13face /vlist.h
parent411d10c845039e33ce4c8dfacaec0bb7af3fd6b5 (diff)
vlist: add static initializer macros
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'vlist.h')
-rw-r--r--vlist.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/vlist.h b/vlist.h
index 9e188e2..8170abf 100644
--- a/vlist.h
+++ b/vlist.h
@@ -41,6 +41,19 @@ struct vlist_node {
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);
#define vlist_find(tree, name, element, node_member) \