(libretro-common) config_file.c - Cleanups

This commit is contained in:
twinaphex 2015-09-22 12:58:22 +02:00
parent 1f852fb23d
commit 2660606f41

View File

@ -35,8 +35,6 @@
#include <xtl.h>
#endif
#include <retro_assert.h>
#include <retro_log.h>
#include <retro_miscellaneous.h>
#include <compat/strl.h>
#include <compat/posix_string.h>
@ -373,18 +371,11 @@ static config_file_t *config_file_new_internal(
return conf;
if (path_is_directory(path))
{
RARCH_ERR("%s is not a regular file.\n", path);
free(conf);
return NULL;
}
goto error;
conf->path = strdup(path);
if (!conf->path)
{
free(conf);
return NULL;
}
goto error;
conf->include_depth = depth;
file = fopen(path, "r");
@ -392,8 +383,7 @@ static config_file_t *config_file_new_internal(
if (!file)
{
free(conf->path);
free(conf);
return NULL;
goto error;
}
while (!feof(file))
@ -434,9 +424,15 @@ static config_file_t *config_file_new_internal(
if (list != conf->tail)
free(list);
}
fclose(file);
return conf;
error:
free(conf);
return NULL;
}
config_file_t *config_file_new_from_string(const char *from_string)