From 1aa6ae1b389c2a18ca2ec48161b9a5b4cd53e812 Mon Sep 17 00:00:00 2001 From: Alcaro Date: Mon, 4 Dec 2017 14:25:16 +0100 Subject: [PATCH] Use FILE* all the way Fixes platforms where RFILE isn't using the FILE* backend, needed for #5664 --- verbosity.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/verbosity.c b/verbosity.c index 83dca5d02f..368067fa96 100644 --- a/verbosity.c +++ b/verbosity.c @@ -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)