Use FILE* all the way

Fixes platforms where RFILE isn't using the FILE* backend, needed for #5664
This commit is contained in:
Alcaro 2017-12-04 14:25:16 +01:00 committed by GitHub
parent e4bb8e7aeb
commit 1aa6ae1b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,8 +49,8 @@
/* If this is non-NULL. RARCH_LOG and friends
* will write to this file. */
static RFILE *log_file = NULL;
static FILE *log_file_fp = NULL;
static void* log_file_buf = NULL;
static bool main_verbosity = false;
static bool log_file_initialized = false;
@ -96,17 +96,21 @@ void retro_main_log_file_init(const char *path)
if (path == NULL)
return;
log_file = filestream_open(path, RFILE_MODE_WRITE, -1);
log_file_fp = filestream_get_fp(log_file);
log_file_fp = fopen(path, "wb");
log_file_initialized = true;
/* TODO: this is only useful for a few platforms, find which and add ifdef */
log_file_buf = (char*)calloc(1, 0x4000);
setvbuf(log_file_fp, log_file_buf, _IOFBF, 0x4000);
}
void retro_main_log_file_deinit(void)
{
if (log_file && log_file_fp != stderr)
filestream_close(log_file);
log_file = NULL;
if (log_file_fp && log_file_fp != stderr)
fclose(log_file_fp);
if (log_file_buf) free(log_file_buf);
log_file_fp = NULL;
log_file_buf = NULL;
}
#if !defined(HAVE_LOGGER)