mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-20 09:52:33 +00:00
Cleanup for config_file_write
This commit is contained in:
parent
ff4dca86f9
commit
059354de2f
@ -912,12 +912,10 @@ void config_set_bool(config_file_t *conf, const char *key, bool val)
|
||||
|
||||
bool config_file_write(config_file_t *conf, const char *path)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
void* buf = NULL;
|
||||
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
file = fopen(path, "wb");
|
||||
void* buf = NULL;
|
||||
FILE *file = fopen(path, "wb");
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
@ -926,15 +924,14 @@ bool config_file_write(config_file_t *conf, const char *path)
|
||||
setvbuf(file, (char*)buf, _IOFBF, 0x4000);
|
||||
|
||||
config_file_dump(conf, file);
|
||||
|
||||
if (file != stdout)
|
||||
fclose(file);
|
||||
free(buf);
|
||||
}
|
||||
else
|
||||
config_file_dump(conf, stdout);
|
||||
|
||||
if (file && file != stdout)
|
||||
fclose(file);
|
||||
if (buf)
|
||||
free(buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user