From b6490994670aeef3240730f8c240a1fe6f98b532 Mon Sep 17 00:00:00 2001 From: meancoot Date: Fri, 21 Jun 2013 23:43:34 -0400 Subject: [PATCH] (iOS) Kill DIAGLOG; will be better to make file logging optional and make the log view able to display to log file. (Allowing the log to persist across crashes and aborts) --- ios/RetroArch/RALogView.m | 49 ----------------------------------- ios/RetroArch/main.m | 4 --- ios/RetroArch/rarch_wrapper.h | 7 ----- 3 files changed, 60 deletions(-) diff --git a/ios/RetroArch/RALogView.m b/ios/RetroArch/RALogView.m index 61e4e41fbc..d384515334 100644 --- a/ios/RetroArch/RALogView.m +++ b/ios/RetroArch/RALogView.m @@ -22,7 +22,6 @@ static NSMutableArray* g_messages; static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; -#ifndef HAVE_DEBUG_DIAGLOG void ios_add_log_message(const char* format, ...) { pthread_mutex_lock(&g_lock); @@ -39,54 +38,6 @@ void ios_add_log_message(const char* format, ...) pthread_mutex_unlock(&g_lock); } -#else -static FILE* old_stdout; -static FILE* old_stderr; -static FILE* log_stream; - -static int stdout_write(void* mem_buffer, const char* data, int len) -{ - pthread_mutex_lock(&g_lock); - - g_messages = g_messages ? g_messages : [NSMutableArray array]; - - char buffer[len + 10]; - strncpy(buffer, data, len); - buffer[len] = 0; - - [g_messages addObject:[NSString stringWithFormat:@"%s", buffer]]; - - pthread_mutex_unlock(&g_lock); - - return len; -} - -void ios_log_init() -{ - if (!log_stream) - { - old_stdout = stdout; - old_stderr = stderr; - - log_stream = fwopen(0, stdout_write); - setvbuf(log_stream, 0, _IOLBF, 0); - - stdout = log_stream; - stderr = log_stream; - } -} - -void ios_log_quit() -{ - if (log_stream) - { - stdout = old_stdout; - stderr = old_stderr; - fclose(log_stream); - log_stream = 0; - } -} -#endif @implementation RALogView diff --git a/ios/RetroArch/main.m b/ios/RetroArch/main.m index e81aee9cbc..179de9fb62 100644 --- a/ios/RetroArch/main.m +++ b/ios/RetroArch/main.m @@ -227,10 +227,6 @@ static void event_reload_config(void* userdata) // UIApplicationDelegate - (void)applicationDidFinishLaunching:(UIApplication *)application { -#ifdef HAVE_DEBUG_DIAGLOG - ios_log_init(); -#endif - self.delegate = self; // Setup window diff --git a/ios/RetroArch/rarch_wrapper.h b/ios/RetroArch/rarch_wrapper.h index 67f7f894f5..be061a16ef 100644 --- a/ios/RetroArch/rarch_wrapper.h +++ b/ios/RetroArch/rarch_wrapper.h @@ -30,13 +30,6 @@ void ios_set_game_view_sync(unsigned interval); void ios_get_game_view_size(unsigned *width, unsigned *height); void ios_bind_game_view_fbo(); -#ifndef HAVE_DEBUG_DIAGLOG void ios_add_log_message(const char* format, ...); -#else -void ios_log_init(); -void ios_log_quit(); -// Thread safe -#define ios_add_log_message(...) do { printf(__VA_ARGS__); printf("\n"); } while(0) -#endif #endif