summaryrefslogtreecommitdiffhomepage
path: root/utils.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-02 19:40:03 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-02 19:40:03 +0200
commit13ec81ce3e2f77504818de0bf89a2a1edd7e0ba2 (patch)
tree73ed054d727c778c4f07bf54e7fbb2a9a3fe64e3 /utils.h
parent98565127c60cba3d5b747bb9eb698e06d187f45b (diff)
vlist: store a pointer to the real key to make lookups easier
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/utils.h b/utils.h
index ab73930..31fcd1f 100644
--- a/utils.h
+++ b/utils.h
@@ -27,7 +27,7 @@ struct vlist_tree {
struct avl_tree avl;
vlist_update_cb update;
- int node_offset;
+ int key_offset;
bool keep_old;
int version;
@@ -40,8 +40,8 @@ struct vlist_node {
void __vlist_init(struct vlist_tree *tree, avl_tree_comp cmp, vlist_update_cb update, int offset);
-#define vlist_init(tree, cmp, update, type, node) \
- __vlist_init(tree, cmp, update, offsetof(type, node))
+#define vlist_init(tree, cmp, update, type, node, key) \
+ __vlist_init(tree, cmp, update, offsetof(type, key) - offsetof(type, node))
void vlist_add(struct vlist_tree *tree, struct vlist_node *node);
void vlist_delete(struct vlist_tree *tree, struct vlist_node *node);