diff options
author | Timo Sirainen <cras@irssi.org> | 2000-08-26 15:39:44 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-08-26 15:39:44 +0000 |
commit | e395e87dedd9aa85f05e5c74330a76f1ef700371 (patch) | |
tree | 1184487b13038499f1771e4c553222f85b8524d2 /src/lib-config/set.c | |
parent | 3d124da13b8da5c0b535abfe6265fc471d9d2ebd (diff) | |
download | irssi-e395e87dedd9aa85f05e5c74330a76f1ef700371.zip |
Lots of moving stuff around - hopefully I didn't break too much :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@632 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/lib-config/set.c')
-rw-r--r-- | src/lib-config/set.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/lib-config/set.c b/src/lib-config/set.c index 4b887558..f750c40a 100644 --- a/src/lib-config/set.c +++ b/src/lib-config/set.c @@ -59,17 +59,23 @@ void config_node_remove(CONFIG_REC *rec, CONFIG_NODE *parent, CONFIG_NODE *node) /* Remove n'th node from a list */ void config_node_list_remove(CONFIG_REC *rec, CONFIG_NODE *node, int index) { - GSList *tmp; + CONFIG_NODE *child; g_return_if_fail(node != NULL); g_return_if_fail(is_node_list(node)); - for (tmp = node->value; tmp != NULL; tmp = tmp->next, index--) { - if (index == 0) { - config_node_remove(rec, node, tmp->data); - break; - } - } + child = config_node_index(node, index); + if (child != NULL) config_node_remove(rec, node, child); +} + +/* Clear all data inside node, but leave the node */ +void config_node_clear(CONFIG_REC *rec, CONFIG_NODE *node) +{ + g_return_if_fail(node != NULL); + g_return_if_fail(is_node_list(node)); + + while (node->value != NULL) + config_node_remove(rec, node, node->value); } void config_nodes_remove_all(CONFIG_REC *rec) |