X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=utils.h;h=c8101e7323a88bc790f806a2f058d414ed1886f2;hp=e872dc55fff872080035fe550c798f280ca9ac78;hb=05e910cec691f8333383a746876015e99ff088db;hpb=69b2dcb92b8402b9c6df4d6a041a890fe6468e18;ds=sidebyside diff --git a/utils.h b/utils.h index e872dc5..c8101e7 100644 --- a/utils.h +++ b/utils.h @@ -27,9 +27,7 @@ struct vlist_tree { struct avl_tree avl; vlist_update_cb update; - - int data_offset; - int data_len; + int node_offset; int version; }; @@ -39,11 +37,10 @@ struct vlist_node { int version; }; -void __vlist_init(struct vlist_tree *tree, vlist_update_cb update, int offset, int len); +void __vlist_init(struct vlist_tree *tree, avl_tree_comp cmp, vlist_update_cb update, int offset); -#define vlist_init(tree, update, type, vlist, first, last) \ - __vlist_init(tree, update, offsetof(type, first) - offsetof(type, vlist), \ - offsetof(type, last) - offsetof(type, first) + sizeof(((type *) 0)->last)) +#define vlist_init(tree, cmp, update, type, node) \ + __vlist_init(tree, cmp, update, 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);