From: bones_was_here Date: Tue, 2 Jan 2024 07:12:42 +0000 (+1000) Subject: deduplicate Sys_Shutdown() X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cd51987a9fd5813e15dfb442b7ded432173390f9;p=xonotic%2Fdarkplaces.git deduplicate Sys_Shutdown() Signed-off-by: bones_was_here --- diff --git a/host.c b/host.c index 8ba2f272..3274be80 100644 --- 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 5dac380d..1b076a69 100644 --- 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 diff --git a/sys_sdl.c b/sys_sdl.c index cec67c8f..ce3d28ce 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -1,6 +1,5 @@ #ifdef WIN32 #else -#include #include #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(); } diff --git a/sys_shared.c b/sys_shared.c index bb7ce9ce..5d19784d 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -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); } diff --git a/sys_unix.c b/sys_unix.c index e041cce0..78b6eeb9 100644 --- a/sys_unix.c +++ b/sys_unix.c @@ -4,7 +4,6 @@ #include #else #include -#include #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)