Use C99 bool internally in SDL

This commit is contained in:
Sam Lantinga
2024-08-22 09:21:26 -07:00
parent 6501e90018
commit 8f546bb3c9
450 changed files with 6046 additions and 6033 deletions

View File

@@ -71,10 +71,10 @@ static void *RunThread(void *data)
}
#if (defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS)) && defined(HAVE_DLOPEN)
static SDL_bool checked_setname = SDL_FALSE;
static bool checked_setname = false;
static int (*ppthread_setname_np)(const char *) = NULL;
#elif defined(SDL_PLATFORM_LINUX) && defined(HAVE_DLOPEN)
static SDL_bool checked_setname = SDL_FALSE;
static bool checked_setname = false;
static int (*ppthread_setname_np)(pthread_t, const char *) = NULL;
#endif
int SDL_SYS_CreateThread(SDL_Thread *thread,
@@ -92,7 +92,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread,
#elif defined(SDL_PLATFORM_LINUX)
ppthread_setname_np = (int (*)(pthread_t, const char *))fn;
#endif
checked_setname = SDL_TRUE;
checked_setname = true;
}
#endif
@@ -186,7 +186,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
int pri_policy;
pthread_t thread = pthread_self();
const char *policyhint = SDL_GetHint(SDL_HINT_THREAD_PRIORITY_POLICY);
const SDL_bool timecritical_realtime_hint = SDL_GetHintBoolean(SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL, SDL_FALSE);
const bool timecritical_realtime_hint = SDL_GetHintBoolean(SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL, false);
if (pthread_getschedparam(thread, &policy, &sched) != 0) {
return SDL_SetError("pthread_getschedparam() failed");

View File

@@ -27,7 +27,7 @@
#define INVALID_PTHREAD_KEY ((pthread_key_t)-1)
static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY;
static SDL_bool generic_local_storage = SDL_FALSE;
static bool generic_local_storage = false;
void SDL_SYS_InitTLSData(void)
{
@@ -35,7 +35,7 @@ void SDL_SYS_InitTLSData(void)
if (pthread_key_create(&thread_local_storage, NULL) != 0) {
thread_local_storage = INVALID_PTHREAD_KEY;
SDL_Generic_InitTLSData();
generic_local_storage = SDL_TRUE;
generic_local_storage = true;
}
}
}
@@ -68,7 +68,7 @@ void SDL_SYS_QuitTLSData(void)
{
if (generic_local_storage) {
SDL_Generic_QuitTLSData();
generic_local_storage = SDL_FALSE;
generic_local_storage = false;
} else {
if (thread_local_storage != INVALID_PTHREAD_KEY) {
pthread_key_delete(thread_local_storage);