projects
/
oweals
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fd50535
)
add a new vlist flag for avoiding automatic delete of entries
author
Felix Fietkau
<nbd@openwrt.org>
Sun, 2 Oct 2011 19:36:21 +0000
(21:36 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Sun, 2 Oct 2011 19:36:21 +0000
(21:36 +0200)
utils.c
patch
|
blob
|
history
utils.h
patch
|
blob
|
history
diff --git
a/utils.c
b/utils.c
index cc222908efa94a414dc650ec92680f0b9d38bafe..31a5967e508f90be115f4943763d746b8064cc07 100644
(file)
--- 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);
diff --git
a/utils.h
b/utils.h
index d71a8f7489f411a38c164c047efe770f6978d0ee..8ef968a91ea3649d6248ed28325157bd2aa2bec3 100644
(file)
--- a/
utils.h
+++ b/
utils.h
@@
-29,6
+29,7
@@
struct vlist_tree {
vlist_update_cb update;
int key_offset;
bool keep_old;
+ bool no_delete;
int version;
};