summaryrefslogtreecommitdiffhomepage
path: root/utils.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-02 21:36:21 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-02 21:36:21 +0200
commit3c024e7b3170bd2d3869a404b08bc20345bc6f81 (patch)
tree82ba48b803807dac4904773194d99794858857ce /utils.c
parentfd50535d7d4060d3cb80f1c317a087507ecfdf2b (diff)
add a new vlist flag for avoiding automatic delete of entries
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils.c b/utils.c
index cc22290..31a5967 100644
--- a/utils.c
+++ b/utils.c
@@ -21,7 +21,8 @@ __vlist_init(struct vlist_tree *tree, avl_tree_comp cmp,
void
vlist_delete(struct vlist_tree *tree, struct vlist_node *node)
{
- avl_delete(&tree->avl, &node->avl);
+ if (!tree->no_delete)
+ avl_delete(&tree->avl, &node->avl);
tree->update(tree, NULL, node);
}
@@ -37,7 +38,7 @@ vlist_add(struct vlist_tree *tree, struct vlist_node *node)
anode = avl_find(&tree->avl, key);
if (anode) {
- if (tree->keep_old)
+ if (tree->keep_old || !tree->no_delete)
goto update_only;
old_node = container_of(anode, struct vlist_node, avl);