better parsing errors
This commit is contained in:
parent
9ff6ea27b1
commit
d8268296fb
2 changed files with 7 additions and 6 deletions
|
@ -89,13 +89,12 @@ gboolean config_set(char *name, ConfigValueType type, ConfigValue value)
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
name = g_ascii_strdown(name, -1);
|
name = g_ascii_strdown(name, -1);
|
||||||
g_message("Setting %s", name);
|
|
||||||
|
|
||||||
/*g_datalist_foreach(&config_def, print_config, NULL);*/
|
/*g_datalist_foreach(&config_def, print_config, NULL);*/
|
||||||
def = g_datalist_get_data(&config_def, name);
|
def = g_datalist_get_data(&config_def, name);
|
||||||
|
|
||||||
if (def == NULL) {
|
if (def == NULL) {
|
||||||
g_message("Invalid config option '%s'", name);
|
g_warning("Invalid config option '%s'", name);
|
||||||
} else {
|
} else {
|
||||||
if (def->hasList) {
|
if (def->hasList) {
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
@ -111,10 +110,12 @@ gboolean config_set(char *name, ConfigValueType type, ConfigValue value)
|
||||||
} while ((it = it->next));
|
} while ((it = it->next));
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
g_message("Invalid value '%s' for config option '%s'",
|
g_warning("Invalid value '%s' for config option '%s'",
|
||||||
value.string, name);
|
value.string, name);
|
||||||
else
|
else
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
} else if (type != def->type) {
|
||||||
|
g_warning("Incorrect type of value for config option '%s'", name);
|
||||||
} else
|
} else
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,10 @@ static void newline()
|
||||||
if (!comment) {
|
if (!comment) {
|
||||||
if (!haserror && entry.name != NULL && (signed)entry.type >= 0) {
|
if (!haserror && entry.name != NULL && (signed)entry.type >= 0) {
|
||||||
if (!config_set(entry.name, entry.type, entry.value))
|
if (!config_set(entry.name, entry.type, entry.value))
|
||||||
g_warning("Invalid option in '%s': '%s'\n",
|
g_warning("Parser error in '%s' on line %d\n", yyfilename,
|
||||||
yyfilename, entry.name);
|
yylineno);
|
||||||
} else {
|
} else {
|
||||||
printf("Parser error in '%s' on line %d\n", yyfilename, yylineno);
|
g_warning("Parser error in '%s' on line %d", yyfilename, yylineno);
|
||||||
}
|
}
|
||||||
g_free(entry.name);
|
g_free(entry.name);
|
||||||
entry.name = NULL;
|
entry.name = NULL;
|
||||||
|
|
Loading…
Reference in a new issue