(libretro-common) config_file.c - Cleanups
This commit is contained in:
parent
1f852fb23d
commit
2660606f41
|
@ -35,8 +35,6 @@
|
||||||
#include <xtl.h>
|
#include <xtl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <retro_assert.h>
|
|
||||||
#include <retro_log.h>
|
|
||||||
#include <retro_miscellaneous.h>
|
#include <retro_miscellaneous.h>
|
||||||
#include <compat/strl.h>
|
#include <compat/strl.h>
|
||||||
#include <compat/posix_string.h>
|
#include <compat/posix_string.h>
|
||||||
|
@ -373,18 +371,11 @@ static config_file_t *config_file_new_internal(
|
||||||
return conf;
|
return conf;
|
||||||
|
|
||||||
if (path_is_directory(path))
|
if (path_is_directory(path))
|
||||||
{
|
goto error;
|
||||||
RARCH_ERR("%s is not a regular file.\n", path);
|
|
||||||
free(conf);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
conf->path = strdup(path);
|
conf->path = strdup(path);
|
||||||
if (!conf->path)
|
if (!conf->path)
|
||||||
{
|
goto error;
|
||||||
free(conf);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
conf->include_depth = depth;
|
conf->include_depth = depth;
|
||||||
file = fopen(path, "r");
|
file = fopen(path, "r");
|
||||||
|
@ -392,8 +383,7 @@ static config_file_t *config_file_new_internal(
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
free(conf->path);
|
free(conf->path);
|
||||||
free(conf);
|
goto error;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!feof(file))
|
while (!feof(file))
|
||||||
|
@ -434,9 +424,15 @@ static config_file_t *config_file_new_internal(
|
||||||
if (list != conf->tail)
|
if (list != conf->tail)
|
||||||
free(list);
|
free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
|
|
||||||
|
error:
|
||||||
|
free(conf);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
config_file_t *config_file_new_from_string(const char *from_string)
|
config_file_t *config_file_new_from_string(const char *from_string)
|
||||||
|
|
Loading…
Reference in New Issue