From 614b9113ad34b3bc9bc87de3cdb8b1914c0633ef Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 4 Dec 2024 18:37:29 +0300 Subject: [PATCH] engine: platform: as an exception, allow calling direct platform-specific implementations of Platform_Sleep to make them inlined --- engine/platform/platform.h | 9 +++------ engine/platform/posix/sys_posix.c | 5 ----- engine/platform/sdl/sys_sdl.c | 5 ----- engine/platform/win32/sys_win.c | 5 ----- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/engine/platform/platform.h b/engine/platform/platform.h index 96c0e2c35..cc8018607 100644 --- a/engine/platform/platform.h +++ b/engine/platform/platform.h @@ -51,13 +51,11 @@ void IOS_LaunchDialog( void ); #if XASH_POSIX void Posix_Daemonize( void ); void Posix_SetupSigtermHandling( void ); -void Posix_Sleep( int msec ); #endif #if XASH_SDL void SDLash_Init( void ); void SDLash_Shutdown( void ); -void SDLash_Sleep( int msec ); #endif #if XASH_ANDROID @@ -78,7 +76,6 @@ void Wcon_ShowConsole( qboolean show ); void Wcon_DisableInput( void ); char *Wcon_Input( void ); void Wcon_WinPrint( const char *pMsg ); -void Win32_Sleep( int msec ); #endif #if XASH_NSWITCH @@ -170,11 +167,11 @@ static inline void Platform_SetupSigtermHandling( void ) static inline void Platform_Sleep( int msec ) { #if XASH_TIMER == TIMER_SDL - SDLash_Sleep( msec ); + SDL_Delay( msec ); #elif XASH_TIMER == TIMER_POSIX - Posix_Sleep( msec ); + usleep( msec * 1000 ); #elif XASH_TIMER == TIMER_WIN32 - Win32_Sleep( msec ); + Sleep( msec ); #else // stub #endif diff --git a/engine/platform/posix/sys_posix.c b/engine/platform/posix/sys_posix.c index ec226a8bc..c0436d4b6 100644 --- a/engine/platform/posix/sys_posix.c +++ b/engine/platform/posix/sys_posix.c @@ -174,8 +174,3 @@ double Platform_DoubleTime( void ) } #endif // XASH_TIMER == TIMER_POSIX -void Posix_Sleep( int msec ) -{ - usleep( msec * 1000 ); -} - diff --git a/engine/platform/sdl/sys_sdl.c b/engine/platform/sdl/sys_sdl.c index 9bbfa348d..01abb740b 100644 --- a/engine/platform/sdl/sys_sdl.c +++ b/engine/platform/sdl/sys_sdl.c @@ -34,11 +34,6 @@ double Platform_DoubleTime( void ) } #endif // XASH_TIMER == TIMER_SDL -void SDLash_Sleep( int msec ) -{ - SDL_Delay( msec ); -} - #if XASH_MESSAGEBOX == MSGBOX_SDL void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow ) { diff --git a/engine/platform/win32/sys_win.c b/engine/platform/win32/sys_win.c index 335b0e6fc..2c783862d 100644 --- a/engine/platform/win32/sys_win.c +++ b/engine/platform/win32/sys_win.c @@ -36,11 +36,6 @@ double Platform_DoubleTime( void ) } #endif // XASH_TIMER == TIMER_WIN32 -void Win32_Sleep( int msec ) -{ - Sleep( msec ); -} - qboolean Platform_DebuggerPresent( void ) { return IsDebuggerPresent();