diff options
author | Alexander Færøy <ahf@0x90.dk> | 2015-04-17 21:23:03 +0200 |
---|---|---|
committer | Alexander Færøy <ahf@0x90.dk> | 2015-04-17 21:23:03 +0200 |
commit | eb0f09073cf15eb033f098d716006a9a1d67fdef (patch) | |
tree | 8b1d63dc022a99731f7ff285a805ce984abc75d7 /src/fe-text | |
parent | 03be2861dcec9e8d088be6a0cae2848388923dab (diff) | |
parent | ee3eaa5428c7a574ad3d34602230f3168f204414 (diff) | |
download | irssi-eb0f09073cf15eb033f098d716006a9a1d67fdef.zip |
Merge pull request #199 from ailin-nemui/config-parser
Make config parser more robust
Diffstat (limited to 'src/fe-text')
-rw-r--r-- | src/fe-text/irssi.c | 3 | ||||
-rw-r--r-- | src/fe-text/mainwindows-layout.c | 3 | ||||
-rw-r--r-- | src/fe-text/statusbar-config.c | 20 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c index 77033d7a..6d5b9b13 100644 --- a/src/fe-text/irssi.c +++ b/src/fe-text/irssi.c @@ -310,6 +310,7 @@ int main(int argc, char **argv) { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL }, { NULL } }; + int loglev; #ifdef USE_GC g_mem_set_vtable(&gc_mem_table); @@ -352,6 +353,7 @@ int main(int argc, char **argv) you have to call setlocale(LC_ALL, "") */ setlocale(LC_ALL, ""); + loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL); textui_init(); if (!dummy && !term_init()) { @@ -360,6 +362,7 @@ int main(int argc, char **argv) return 1; } + g_log_set_always_fatal(loglev); textui_finish_init(); main_loop = g_main_new(TRUE); diff --git a/src/fe-text/mainwindows-layout.c b/src/fe-text/mainwindows-layout.c index 28fae924..020969e6 100644 --- a/src/fe-text/mainwindows-layout.c +++ b/src/fe-text/mainwindows-layout.c @@ -70,7 +70,7 @@ static void main_window_save(MAIN_WINDOW_REC *window, CONFIG_NODE *node) char num[MAX_INT_STRLEN]; ltoa(num, window->active->refnum); - node = config_node_section(node, num, NODE_TYPE_BLOCK); + node = iconfig_node_section(node, num, NODE_TYPE_BLOCK); iconfig_node_set_int(node, "first_line", window->first_line); iconfig_node_set_int(node, "lines", window->height); @@ -179,6 +179,7 @@ static void sig_layout_restore(void) lower_window = NULL; lower_size = 0; for (i = 0, tmp = sorted_config; i < windows_count; tmp = tmp->next, i++) { CONFIG_NODE *node = tmp->data; + if (node->key == NULL) continue; /* create a new window + mainwindow */ signal_emit("gui window create override", 1, diff --git a/src/fe-text/statusbar-config.c b/src/fe-text/statusbar-config.c index 7b3fe252..a47a709e 100644 --- a/src/fe-text/statusbar-config.c +++ b/src/fe-text/statusbar-config.c @@ -177,7 +177,7 @@ static void statusbar_read(STATUSBAR_GROUP_REC *group, CONFIG_NODE *node) bar->placement = STATUSBAR_TOP; bar->position = config_node_get_int(node, "position", 0); - node = config_node_section(node, "items", -1); + node = iconfig_node_section(node, "items", -1); if (node != NULL) { /* we're overriding the items - destroy the old */ while (bar->items != NULL) @@ -227,7 +227,7 @@ static void read_statusbar_config_from_node(CONFIG_NODE *node) CONFIG_NODE *items; GSList *tmp; - items = config_node_section(node, "items", -1); + items = iconfig_node_section(node, "items", -1); if (items != NULL) statusbar_read_items(items); @@ -369,7 +369,7 @@ static void cmd_statusbar_reset(const char *data, void *server, CONFIG_NODE *parent; parent = iconfig_node_traverse("statusbar", TRUE); - parent = config_node_section(parent, active_statusbar_group->name, + parent = iconfig_node_section(parent, active_statusbar_group->name, NODE_TYPE_BLOCK); iconfig_node_set_str(parent, node->key, NULL); @@ -432,7 +432,7 @@ static CONFIG_NODE *statusbar_items_section(CONFIG_NODE *parent) CONFIG_NODE *node; GSList *tmp; - node = config_node_section(parent, "items", -1); + node = iconfig_node_section(parent, "items", -1); if (node != NULL) return node; @@ -446,11 +446,11 @@ static CONFIG_NODE *statusbar_items_section(CONFIG_NODE *parent) /* since items list in config file overrides defaults, we'll need to copy the whole list. */ - parent = config_node_section(parent, "items", NODE_TYPE_BLOCK); + parent = iconfig_node_section(parent, "items", NODE_TYPE_BLOCK); for (tmp = bar->items; tmp != NULL; tmp = tmp->next) { SBAR_ITEM_CONFIG_REC *rec = tmp->data; - node = config_node_section(parent, rec->name, + node = iconfig_node_section(parent, rec->name, NODE_TYPE_BLOCK); if (rec->priority != 0) iconfig_node_set_int(node, "priority", rec->priority); @@ -487,7 +487,7 @@ static void cmd_statusbar_add(const char *data, void *server, if (value != NULL) index = config_node_index(node, value)+1; /* create/move item */ - node = config_node_section_index(node, name, index, NODE_TYPE_BLOCK); + node = iconfig_node_section_index(node, name, index, NODE_TYPE_BLOCK); /* set the options */ value = g_hash_table_lookup(optlist, "priority"); @@ -511,7 +511,7 @@ static void cmd_statusbar_remove(const char *data, void *server, if (node == NULL) return; - if (config_node_section(node, data, -1) != NULL) + if (iconfig_node_section(node, data, -1) != NULL) iconfig_node_set_str(node, data, NULL); else { printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, @@ -545,9 +545,9 @@ static void cmd_statusbar(const char *data) /* lookup/create the statusbar node */ node = iconfig_node_traverse("statusbar", TRUE); - node = config_node_section(node, active_statusbar_group->name, + node = iconfig_node_section(node, active_statusbar_group->name, NODE_TYPE_BLOCK); - node = config_node_section(node, name, NODE_TYPE_BLOCK); + node = iconfig_node_section(node, name, NODE_TYPE_BLOCK); /* call the subcommand */ signal = g_strconcat("command statusbar ", cmd, NULL); |