summaryrefslogtreecommitdiff
path: root/src/lib-config
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib-config')
-rw-r--r--src/lib-config/get.c3
-rw-r--r--src/lib-config/parse.c9
2 files changed, 7 insertions, 5 deletions
diff --git a/src/lib-config/get.c b/src/lib-config/get.c
index 4db6b4b7..98e2a30b 100644
--- a/src/lib-config/get.c
+++ b/src/lib-config/get.c
@@ -203,7 +203,8 @@ char *config_node_get_str(CONFIG_NODE *parent, const char *key, const char *def)
if (parent == NULL) return (char *) def;
node = config_node_find(parent, key);
- return (node == NULL || !has_node_value(node)) ? def : node->value;
+ return (char *) ((node != NULL && has_node_value(node)) ?
+ node->value : def);
}
int config_node_get_int(CONFIG_NODE *parent, const char *key, int def)
diff --git a/src/lib-config/parse.c b/src/lib-config/parse.c
index 05b76975..1c468ad8 100644
--- a/src/lib-config/parse.c
+++ b/src/lib-config/parse.c
@@ -134,8 +134,9 @@ static void config_parse_loop(CONFIG_REC *rec, CONFIG_NODE *node, GTokenType exp
static int config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
{
CONFIG_NODE *newnode;
+ GTokenType last_char;
int print_warning;
- char *key, last_char;
+ char *key;
g_return_val_if_fail(rec != NULL, G_TOKEN_ERROR);
g_return_val_if_fail(node != NULL, G_TOKEN_ERROR);
@@ -182,7 +183,7 @@ static int config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
return G_TOKEN_ERROR;
newnode = config_node_section(node, key, NODE_TYPE_BLOCK);
- config_parse_loop(rec, newnode, '}');
+ config_parse_loop(rec, newnode, (GTokenType) '}');
g_free_not_null(key);
config_parse_get_token(rec->scanner, node);
@@ -197,7 +198,7 @@ static int config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
if (key == NULL)
return G_TOKEN_ERROR;
newnode = config_node_section(node, key, NODE_TYPE_LIST);
- config_parse_loop(rec, newnode, ')');
+ config_parse_loop(rec, newnode, (GTokenType) ')');
g_free_not_null(key);
config_parse_get_token(rec->scanner, node);
@@ -218,7 +219,7 @@ static int config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
static void config_parse_loop(CONFIG_REC *rec, CONFIG_NODE *node, GTokenType expect)
{
- int expected_token;
+ GTokenType expected_token;
g_return_if_fail(rec != NULL);
g_return_if_fail(node != NULL);