diff options
author | Timo Sirainen <cras@irssi.org> | 2000-04-26 08:10:09 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-04-26 08:10:09 +0000 |
commit | d29ca0b107a5b6abb4eadd036f37acd33bb72ed0 (patch) | |
tree | bcf53c98b5166a33753fc70444c24118ae8da9d1 /src/lib-config/set.c | |
parent | c95034c6de1bf72536595e1e3431d8ec64b9880e (diff) | |
download | irssi-d29ca0b107a5b6abb4eadd036f37acd33bb72ed0.zip |
rest of the ~rewrite?
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@172 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/lib-config/set.c')
-rw-r--r-- | src/lib-config/set.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib-config/set.c b/src/lib-config/set.c index 49457576..6748fce9 100644 --- a/src/lib-config/set.c +++ b/src/lib-config/set.c @@ -43,6 +43,22 @@ void config_node_remove(CONFIG_NODE *parent, CONFIG_NODE *node) g_free(node); } +/* Remove n'th node from a list */ +void config_node_list_remove(CONFIG_NODE *node, int index) +{ + GSList *tmp; + + 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(node, tmp->data); + break; + } + } +} + void config_nodes_remove_all(CONFIG_REC *rec) { g_return_if_fail(rec != NULL); @@ -120,3 +136,12 @@ int config_set_bool(CONFIG_REC *rec, const char *section, const char *key, int v { return config_set_str(rec, section, key, value ? "yes" : "no"); } + +/* Add all values in `array' to `node' */ +void config_node_add_list(CONFIG_NODE *node, char **array) +{ + char **tmp; + + for (tmp = array; *tmp != NULL; tmp++) + config_node_set_str(node, NULL, *tmp); +} |