mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 14:26:01 +00:00
Removed SDL_bool in favor of plain bool
We require stdbool.h in the build environment, so we might as well use the plain bool type. If your environment doesn't have stdbool.h, this simple replacement will suffice: typedef signed char bool;
This commit is contained in:
@@ -54,7 +54,7 @@ void *SDL_GetTLS(SDL_TLSID *id)
|
||||
return storage->array[storage_index].data;
|
||||
}
|
||||
|
||||
SDL_bool SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor)
|
||||
bool SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor)
|
||||
{
|
||||
SDL_TLSData *storage;
|
||||
int storage_index;
|
||||
@@ -439,7 +439,7 @@ const char *SDL_GetThreadName(SDL_Thread *thread)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_SetThreadPriority(SDL_ThreadPriority priority)
|
||||
bool SDL_SetThreadPriority(SDL_ThreadPriority priority)
|
||||
{
|
||||
return SDL_SYS_SetThreadPriority(priority);
|
||||
}
|
||||
@@ -483,12 +483,12 @@ void SDL_WaitSemaphore(SDL_Semaphore *sem)
|
||||
SDL_WaitSemaphoreTimeoutNS(sem, -1);
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryWaitSemaphore(SDL_Semaphore *sem)
|
||||
bool SDL_TryWaitSemaphore(SDL_Semaphore *sem)
|
||||
{
|
||||
return SDL_WaitSemaphoreTimeoutNS(sem, 0);
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS)
|
||||
bool SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS)
|
||||
{
|
||||
Sint64 timeoutNS;
|
||||
|
||||
@@ -505,7 +505,7 @@ void SDL_WaitCondition(SDL_Condition *cond, SDL_Mutex *mutex)
|
||||
SDL_WaitConditionTimeoutNS(cond, mutex, -1);
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitConditionTimeout(SDL_Condition *cond, SDL_Mutex *mutex, Sint32 timeoutMS)
|
||||
bool SDL_WaitConditionTimeout(SDL_Condition *cond, SDL_Mutex *mutex, Sint32 timeoutMS)
|
||||
{
|
||||
Sint64 timeoutNS;
|
||||
|
||||
|
@@ -219,7 +219,7 @@ bool SDL_WaitConditionTimeoutNS_generic(SDL_Condition *_cond, SDL_Mutex *mutex,
|
||||
}
|
||||
|
||||
#ifndef SDL_THREAD_GENERIC_COND_SUFFIX
|
||||
SDL_bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
|
||||
bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
|
||||
{
|
||||
return SDL_WaitConditionTimeoutNS_generic(cond, mutex, timeoutNS);
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@ void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doe
|
||||
#endif // SDL_THREADS_DISABLED
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
bool result = true;
|
||||
#ifndef SDL_THREADS_DISABLED
|
||||
|
@@ -139,7 +139,7 @@ bool SDL_TryLockRWLockForReading_generic(SDL_RWLock *rwlock)
|
||||
}
|
||||
|
||||
#ifndef SDL_THREAD_GENERIC_RWLOCK_SUFFIX
|
||||
SDL_bool SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
||||
bool SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
||||
{
|
||||
return SDL_TryLockRWLockForReading_generic(rwlock);
|
||||
}
|
||||
@@ -167,7 +167,7 @@ bool SDL_TryLockRWLockForWriting_generic(SDL_RWLock *rwlock)
|
||||
}
|
||||
|
||||
#ifndef SDL_THREAD_GENERIC_RWLOCK_SUFFIX
|
||||
SDL_bool SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
|
||||
bool SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
|
||||
{
|
||||
return SDL_TryLockRWLockForWriting_generic(rwlock);
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
{
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
|
@@ -90,7 +90,7 @@ Thread B:
|
||||
SDL_SignalCondition(cond);
|
||||
SDL_UnlockMutex(lock);
|
||||
*/
|
||||
SDL_bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
|
||||
bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
|
||||
{
|
||||
Result res;
|
||||
|
||||
|
@@ -49,7 +49,7 @@ void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doe
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
if (mutex) {
|
||||
return RecursiveLock_TryLock(&mutex->lock);
|
||||
|
@@ -74,7 +74,7 @@ static bool WaitOnSemaphoreFor(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
{
|
||||
if (!sem) {
|
||||
return true;
|
||||
|
@@ -78,7 +78,7 @@ void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang does
|
||||
|
||||
// Try to lock the mutex
|
||||
#if 0
|
||||
SDL_bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
if (mutex) {
|
||||
// Not yet implemented.
|
||||
|
@@ -72,7 +72,7 @@ void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
{
|
||||
u64 timeout_usec;
|
||||
u64 *timeout_ptr;
|
||||
|
@@ -72,7 +72,7 @@ void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doe
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
bool result = true;
|
||||
if (mutex) {
|
||||
|
@@ -71,7 +71,7 @@ void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
* If the timeout is 0 then just poll the semaphore; if it's -1, pass
|
||||
* NULL to sceKernelWaitSema() so that it waits indefinitely; and if the timeout
|
||||
* is specified, convert it to microseconds. */
|
||||
SDL_bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
{
|
||||
SceUInt timeoutUS;
|
||||
SceUInt *pTimeout = NULL;
|
||||
|
@@ -78,7 +78,7 @@ void SDL_BroadcastCondition(SDL_Condition *cond)
|
||||
pthread_cond_broadcast(&cond->cond);
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
|
||||
bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
|
||||
{
|
||||
#ifndef HAVE_CLOCK_GETTIME
|
||||
struct timeval delta;
|
||||
|
@@ -82,7 +82,7 @@ void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang does
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
|
@@ -69,7 +69,7 @@ void SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
||||
bool SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
@@ -86,7 +86,7 @@ SDL_bool SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
||||
return result;
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
|
||||
bool SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
|
@@ -60,7 +60,7 @@ void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
{
|
||||
#ifdef HAVE_SEM_TIMEDWAIT
|
||||
#ifndef HAVE_CLOCK_GETTIME
|
||||
|
@@ -68,7 +68,7 @@ void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doe
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
|
@@ -72,7 +72,7 @@ void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
* If the timeout is 0 then just poll the semaphore; if it's -1, pass
|
||||
* NULL to sceKernelWaitSema() so that it waits indefinitely; and if the timeout
|
||||
* is specified, convert it to microseconds. */
|
||||
SDL_bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
{
|
||||
SceUInt timeoutUS;
|
||||
SceUInt *pTimeout = NULL;
|
||||
|
@@ -216,7 +216,7 @@ void SDL_BroadcastCondition(SDL_Condition *cond)
|
||||
SDL_cond_impl_active.Broadcast(cond);
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
|
||||
bool SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS)
|
||||
{
|
||||
if (!cond || !mutex) {
|
||||
return true;
|
||||
|
@@ -218,7 +218,7 @@ void SDL_LockMutex(SDL_Mutex *mutex)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
bool SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
|
@@ -204,7 +204,7 @@ void SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SDL_NO_THREAD_SAFETY_ANALYSIS
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
||||
bool SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
||||
{
|
||||
bool result = true;
|
||||
if (rwlock) {
|
||||
@@ -213,7 +213,7 @@ SDL_bool SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
||||
return result;
|
||||
}
|
||||
|
||||
SDL_bool SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
|
||||
bool SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock)
|
||||
{
|
||||
bool result = true;
|
||||
if (rwlock) {
|
||||
|
@@ -333,7 +333,7 @@ void SDL_DestroySemaphore(SDL_Semaphore *sem)
|
||||
SDL_sem_impl_active.Destroy(sem);
|
||||
}
|
||||
|
||||
SDL_bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
{
|
||||
return SDL_sem_impl_active.WaitTimeoutNS(sem, timeoutNS);
|
||||
}
|
||||
|
Reference in New Issue
Block a user