From 0ce3f8243eb564063c66a1b32169109af17e4081 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 2 Feb 2002 17:37:44 +0000 Subject: [PATCH] Comments are now allowed everywhere in config files. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2374 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/channels-setup.c | 3 ++- src/core/chatnets.c | 8 +++++-- src/core/ignore.c | 3 ++- src/core/log.c | 6 +++-- src/core/servers-setup.c | 3 ++- src/core/session.c | 9 +++++--- src/core/settings.c | 36 ++++------------------------- src/fe-common/core/completion.c | 4 ++-- src/fe-common/core/fe-settings.c | 4 ++-- src/fe-common/core/hilight-text.c | 3 ++- src/fe-common/core/keyboard.c | 6 +++-- src/fe-common/core/windows-layout.c | 6 +++-- src/fe-text/mainwindows-layout.c | 3 ++- src/irc/notifylist/notify-setup.c | 3 ++- 14 files changed, 45 insertions(+), 52 deletions(-) diff --git a/src/core/channels-setup.c b/src/core/channels-setup.c index a53bd3f3..e434cd9c 100644 --- a/src/core/channels-setup.c +++ b/src/core/channels-setup.c @@ -158,7 +158,8 @@ static void channels_read_config(void) /* Read channels */ node = iconfig_node_traverse("channels", FALSE); if (node != NULL) { - for (tmp = node->value; tmp != NULL; tmp = tmp->next) + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) channel_setup_read(tmp->data); } } diff --git a/src/core/chatnets.c b/src/core/chatnets.c index 62c31c98..1b1b718c 100644 --- a/src/core/chatnets.c +++ b/src/core/chatnets.c @@ -162,6 +162,7 @@ static void chatnet_read(CONFIG_NODE *node) static void read_chatnets(void) { CONFIG_NODE *node; + GSList *tmp; while (chatnets != NULL) chatnet_destroy(chatnets->data); @@ -178,8 +179,11 @@ static void read_chatnets(void) } } - if (node != NULL) - g_slist_foreach(node->value, (GFunc) chatnet_read, NULL); + if (node != NULL) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) + chatnet_read(tmp->data); + } } void chatnets_init(void) diff --git a/src/core/ignore.c b/src/core/ignore.c index 8c7c5d12..c98646c1 100644 --- a/src/core/ignore.c +++ b/src/core/ignore.c @@ -408,7 +408,8 @@ static void read_ignores(void) return; } - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; if (node->type != NODE_TYPE_BLOCK) diff --git a/src/core/log.c b/src/core/log.c index f88bdb0a..ccad07ca 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -473,7 +473,8 @@ static void log_items_read_config(CONFIG_NODE *node, LOG_REC *log) char *item; int type; - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; if (node->type != NODE_TYPE_BLOCK) @@ -516,7 +517,8 @@ static void log_read_config(void) node = iconfig_node_traverse("logs", FALSE); if (node == NULL) return; - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; if (node->type != NODE_TYPE_BLOCK) diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 8289b2c3..1412a1a7 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -493,7 +493,8 @@ static void read_servers(void) /* Read servers */ node = iconfig_node_traverse("servers", FALSE); if (node != NULL) { - for (tmp = node->value; tmp != NULL; tmp = tmp->next) + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) server_setup_read(tmp->data); } } diff --git a/src/core/session.c b/src/core/session.c index e72bf64a..0248f13e 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -201,7 +201,8 @@ static void session_restore_channel_nicks(CHANNEL_REC *channel, /* restore nicks */ node = config_node_section(node, "nicks", -1); if (node != NULL && node->type == NODE_TYPE_LIST) { - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { signal_emit("session restore nick", 2, channel, tmp->data); } @@ -233,7 +234,8 @@ static void session_restore_server_channels(SERVER_REC *server, /* restore channels */ node = config_node_section(node, "channels", -1); if (node != NULL && node->type == NODE_TYPE_LIST) { - for (tmp = node->value; tmp != NULL; tmp = tmp->next) + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) session_restore_channel(server, tmp->data); } } @@ -304,7 +306,8 @@ static void sig_session_restore(CONFIG_REC *config) /* restore servers */ node = config_node_traverse(config, "(servers", FALSE); if (node != NULL) { - for (tmp = node->value; tmp != NULL; tmp = config_node_next(tmp)) + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) session_restore_server(tmp->data); } diff --git a/src/core/settings.c b/src/core/settings.c index b13163e0..1a98462a 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -280,20 +280,6 @@ static void sig_init_finished(void) } } -/* FIXME: remove after 0.7.98 - only for backward compatibility */ -static void settings_move(SETTINGS_REC *rec, char *value) -{ - CONFIG_NODE *setnode, *node; - - setnode = iconfig_node_traverse("settings", TRUE); - node = config_node_section(setnode, rec->module, NODE_TYPE_BLOCK); - - iconfig_node_set_str(node, rec->key, value); - iconfig_node_set_str(setnode, rec->key, NULL); - - config_changed = TRUE; -} - static void settings_clean_invalid_module(const char *module) { CONFIG_NODE *node; @@ -306,9 +292,9 @@ static void settings_clean_invalid_module(const char *module) node = config_node_section(node, module, -1); if (node == NULL) return; - for (tmp = node->value; tmp != NULL; tmp = next) { + for (tmp = config_node_first(node->value); tmp != NULL; tmp = next) { CONFIG_NODE *subnode = tmp->data; - next = tmp->next; + next = config_node_next(tmp); set = g_hash_table_lookup(settings, subnode->key); if (set == NULL || strcmp(set->module, module) != 0) @@ -338,25 +324,12 @@ void settings_check_module(const char *module) SETTINGS_REC *set; CONFIG_NODE *node; GString *errors; - GSList *tmp, *next; + GSList *tmp; int count; g_return_if_fail(module != NULL); node = iconfig_node_traverse("settings", FALSE); - if (node != NULL) { - /* FIXME: remove after 0.7.98 */ - for (tmp = node->value; tmp != NULL; tmp = next) { - CONFIG_NODE *node = tmp->data; - - next = tmp->next; - if (node->type != NODE_TYPE_KEY) - continue; - set = g_hash_table_lookup(settings, node->key); - if (set != NULL) - settings_move(set, node->value); - } - } node = node == NULL ? NULL : config_node_section(node, module, -1); if (node == NULL) return; @@ -365,7 +338,8 @@ void settings_check_module(const char *module) "file for module %s:", module); count = 0; - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; set = g_hash_table_lookup(settings, node->key); diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c index 399465ed..b36cb0f7 100644 --- a/src/fe-common/core/completion.c +++ b/src/fe-common/core/completion.c @@ -360,11 +360,11 @@ static GList *completion_get_aliases(const char *alias, char cmdchar) /* get list of aliases from mainconfig */ node = iconfig_node_traverse("aliases", FALSE); - tmp = node == NULL ? NULL : node->value; + tmp = node == NULL ? NULL : config_node_first(node->value); len = strlen(alias); complist = NULL; - for (; tmp != NULL; tmp = tmp->next) { + for (; tmp != NULL; tmp = config_node_next(tmp)) { CONFIG_NODE *node = tmp->data; if (node->type != NODE_TYPE_KEY) diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c index bb4405fa..382a09f7 100644 --- a/src/fe-common/core/fe-settings.c +++ b/src/fe-common/core/fe-settings.c @@ -173,12 +173,12 @@ static void show_aliases(const char *alias) printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_ALIASLIST_HEADER); node = iconfig_node_traverse("aliases", FALSE); - tmp = node == NULL ? NULL : node->value; + tmp = node == NULL ? NULL : config_node_first(node->value); /* first get the list of aliases sorted */ list = NULL; aliaslen = strlen(alias); - for (; tmp != NULL; tmp = tmp->next) { + for (; tmp != NULL; tmp = config_node_next(tmp)) { CONFIG_NODE *node = tmp->data; if (node->type != NODE_TYPE_KEY) diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 7fa970bb..0bdda55f 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -399,7 +399,8 @@ static void read_hilight_config(void) return; } - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; if (node->type != NODE_TYPE_BLOCK) diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index b3619bba..ac682001 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -114,7 +114,8 @@ static CONFIG_NODE *key_config_find(const char *key) /* remove old keyboard settings */ node = iconfig_node_traverse("(keyboard", TRUE); - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; if (strcmp(config_node_get_str(node, "key", ""), key) == 0) @@ -794,7 +795,8 @@ static void read_keyboard_config(void) return; } - for (tmp = node->value; tmp != NULL; tmp = tmp->next) + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) key_config_read(tmp->data); key_configure_thaw(); diff --git a/src/fe-common/core/windows-layout.c b/src/fe-common/core/windows-layout.c index 9615006e..56ebcb89 100644 --- a/src/fe-common/core/windows-layout.c +++ b/src/fe-common/core/windows-layout.c @@ -81,7 +81,8 @@ static void window_add_items(WINDOW_REC *window, CONFIG_NODE *node) if (node == NULL) return; - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { CONFIG_NODE *node = tmp->data; type = config_node_get_str(node, "type", NULL); @@ -106,7 +107,8 @@ static void sig_layout_restore(void) node = iconfig_node_traverse("windows", FALSE); if (node == NULL) return; - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { CONFIG_NODE *node = tmp->data; window = window_find_refnum(atoi(node->key)); diff --git a/src/fe-text/mainwindows-layout.c b/src/fe-text/mainwindows-layout.c index d3df6b86..072b9b2c 100644 --- a/src/fe-text/mainwindows-layout.c +++ b/src/fe-text/mainwindows-layout.c @@ -99,7 +99,8 @@ static GSList *get_sorted_windows_config(CONFIG_NODE *node) GSList *tmp, *output; output = NULL; - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { output = g_slist_insert_sorted(output, tmp->data, (GCompareFunc) window_node_cmp); } diff --git a/src/irc/notifylist/notify-setup.c b/src/irc/notifylist/notify-setup.c index e2a3195a..72cc08fb 100644 --- a/src/irc/notifylist/notify-setup.c +++ b/src/irc/notifylist/notify-setup.c @@ -65,7 +65,8 @@ void notifylist_read_config(void) node = iconfig_node_traverse("notifies", FALSE); if (node == NULL) return; - for (tmp = node->value; tmp != NULL; tmp = tmp->next) { + tmp = config_node_first(node->value); + for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; if (node->type != NODE_TYPE_BLOCK)