]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
deduplicate Sys_Shutdown()
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 2 Jan 2024 07:12:42 +0000 (17:12 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Wed, 3 Jan 2024 00:36:22 +0000 (10:36 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
host.c
sys.h
sys_sdl.c
sys_shared.c
sys_unix.c

diff --git a/host.c b/host.c
index 8ba2f272b3dd72eb41eeb3a06ba4ec3f3fcf5f2a..3274be807cd098c522c2953c076f25092f7e3327 100644 (file)
--- a/host.c
+++ b/host.c
@@ -613,7 +613,7 @@ void Host_Shutdown(void)
        TaskQueue_Shutdown();
        Thread_Shutdown();
        Cmd_Shutdown();
-       Sys_Shutdown();
+       Sys_SDL_Shutdown();
        Log_Close();
        Crypto_Shutdown();
 
diff --git a/sys.h b/sys.h
index 5dac380d8613bc03f3929946be77a66d122bdbc7..1b076a697f6fdb3ef4673111e533b4594394b664 100644 (file)
--- a/sys.h
+++ b/sys.h
@@ -212,7 +212,7 @@ void Sys_Print(const char *text);
 void Sys_Printf(const char *fmt, ...);
 
 /// INFO: This is only called by Host_Shutdown so we dont need testing for recursion
-void Sys_Shutdown (void);
+void Sys_SDL_Shutdown(void);
 void Sys_Quit (int returnvalue);
 
 /*! on some build/platform combinations (such as Linux gcc with the -pg
index cec67c8f67b92e5793a8dbb4f04d6e480de61ecf..ce3d28cece51a03d9756697f2d5d7e331a8b07cc 100644 (file)
--- a/sys_sdl.c
+++ b/sys_sdl.c
@@ -1,6 +1,5 @@
 #ifdef WIN32
 #else
-#include <fcntl.h>
 #include <sys/time.h>
 #endif
 
@@ -25,15 +24,8 @@ sys_t sys;
 // General routines
 // =======================================================================
 
-void Sys_Shutdown (void)
+void Sys_SDL_Shutdown(void)
 {
-#ifdef __ANDROID__
-       Sys_AllowProfiling(false);
-#endif
-#ifndef WIN32
-       fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
-#endif
-       fflush(stdout);
        SDL_Quit();
 }
 
index bb7ce9ce8504665c854625ef38dcd5443383f0d9..5d19784daf45354765868ebdf13581026b75caf3 100644 (file)
@@ -65,6 +65,15 @@ void Sys_Quit (int returnvalue)
                Sys_AllowProfiling(false);
        host.state = host_shutdown;
        Host_Shutdown();
+
+#ifdef __ANDROID__
+       Sys_AllowProfiling(false);
+#endif
+#ifndef WIN32
+       fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
+#endif
+       fflush(stdout);
+
        exit(returnvalue);
 }
 
index e041cce0bfd924e23bb17dbbd7a3f5ef29bdcc3d..78b6eeb96de5f0a2d132325025922e97f4f9957c 100644 (file)
@@ -4,7 +4,6 @@
 #include <mmsystem.h>
 #else
 #include <sys/time.h>
-#include <fcntl.h>
 #endif
 
 #include "darkplaces.h"
@@ -14,12 +13,8 @@ sys_t sys;
 // =======================================================================
 // General routines
 // =======================================================================
-void Sys_Shutdown (void)
+void Sys_SDL_Shutdown(void)
 {
-#ifndef WIN32
-       fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
-#endif
-       fflush(stdout);
 }
 
 void Sys_SDL_Dialog(const char *title, const char *string)