diff options
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -43,7 +43,7 @@ tern_node * parse_config_int(char **state, int started, int *line) config_data = started ? NULL : *state; while ((curline = strtok_r(config_data, "\n", state))) { - + config_data = NULL; curline = strip_ws(curline); int len = strlen(curline); @@ -61,7 +61,7 @@ tern_node * parse_config_int(char **state, int started, int *line) } fatal_error("unexpected } on line %d\n", *line); } - + char * end = curline + len - 1; if (*end == '{') { *end = 0; @@ -128,7 +128,7 @@ tern_node * parse_config_file_assets(char *config_path) if (!config_size) { goto config_empty; } - + char * config_data = malloc(config_size+1); if (SDL_RWread(rw, config_data, 1, config_size) != config_size) { goto config_read_fail; @@ -152,12 +152,12 @@ tern_node * load_config() if (ret) { return ret; } - + ret = parse_config_file_assets("default.cfg"); if (ret) { return ret; } - + fatal_error("Failed to find a config file in internal storage or in the blastem APK\n"); //this will never get reached, but the compiler doesn't know that. Let's make it happy return NULL; @@ -169,25 +169,26 @@ tern_node * load_config() { char * exe_dir; char * home = get_home_dir(); - if (home) { + tern_node *ret; + if (home) { char * path = alloc_concat(home, "/.config/blastem/blastem.cfg"); - tern_node * ret = parse_config_file(path); + ret = parse_config_file(path); free(path); if (ret) { return ret; } } - + exe_dir = get_exe_dir(); - if (exe_dir) { - path = alloc_concat(exe_dir, "/default.cfg"); + if (exe_dir) { + char *path = alloc_concat(exe_dir, "/default.cfg"); ret = parse_config_file(path); free(path); if (ret) { return ret; } } - + fatal_error("Failed to find a config file in ~/.config/blastem/blastem.cfg or in the blastem executable directory\n"); //this will never get reached, but the compiler doesn't know that. Let's make it happy return NULL; |