mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 06:45:59 +00:00
Use #ifdef/#ifndef instead of #if defined/#if \!defined
This commit is contained in:

committed by
Anonymous Maarten

parent
308bcbbe76
commit
b6ae281e97
@@ -219,7 +219,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data)
|
||||
SDL_error *
|
||||
SDL_GetErrBuf(void)
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return SDL_GetStaticErrBuf();
|
||||
#else
|
||||
static SDL_SpinLock tls_lock;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#define SDL_thread_c_h_
|
||||
|
||||
/* Need the definitions of SYS_ThreadHandle */
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
#include "generic/SDL_systhread_c.h"
|
||||
#elif defined(SDL_THREAD_PTHREAD)
|
||||
#include "pthread/SDL_systhread_c.h"
|
||||
|
@@ -32,7 +32,7 @@
|
||||
* will be chosen at runtime), the function names need to be
|
||||
* suffixed
|
||||
*/
|
||||
#if !defined(SDL_THREAD_GENERIC_COND_SUFFIX)
|
||||
#ifndef SDL_THREAD_GENERIC_COND_SUFFIX
|
||||
#define SDL_CreateCond_generic SDL_CreateCond
|
||||
#define SDL_DestroyCond_generic SDL_DestroyCond
|
||||
#define SDL_CondSignal_generic SDL_CondSignal
|
||||
|
@@ -72,7 +72,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
|
||||
/* Lock the mutex */
|
||||
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
SDL_threadID this_thread;
|
||||
@@ -101,7 +101,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
|
||||
/* try Lock the mutex */
|
||||
int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
int retval = 0;
|
||||
@@ -133,7 +133,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
/* Unlock the mutex */
|
||||
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
if (mutex == NULL) {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "SDL_systhread_c.h"
|
||||
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
|
||||
SDL_sem *
|
||||
SDL_CreateSemaphore(Uint32 initial_value)
|
||||
|
@@ -75,7 +75,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
|
||||
/* Lock the mutex */
|
||||
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
SceInt32 res = 0;
|
||||
@@ -96,7 +96,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
|
||||
/* Try to lock the mutex */
|
||||
int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
SceInt32 res = 0;
|
||||
@@ -125,7 +125,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
/* Unlock the mutex */
|
||||
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
SceInt32 res = 0;
|
||||
|
@@ -48,7 +48,7 @@ SDL_CreateMutex(void)
|
||||
mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex));
|
||||
if (mutex) {
|
||||
pthread_mutexattr_init(&attr);
|
||||
#if defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
|
||||
#ifdef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
#elif defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
|
||||
pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
|
@@ -133,7 +133,7 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
#endif
|
||||
}
|
||||
#elif defined(HAVE_PTHREAD_SETNAME_NP)
|
||||
#if defined(__NETBSD__)
|
||||
#ifdef __NETBSD__
|
||||
pthread_setname_np(pthread_self(), "%s", name);
|
||||
#else
|
||||
if (pthread_setname_np(pthread_self(), name) == ERANGE) {
|
||||
@@ -176,7 +176,7 @@ SDL_ThreadID(void)
|
||||
|
||||
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
|
||||
{
|
||||
#if defined(__RISCOS__)
|
||||
#ifdef __RISCOS__
|
||||
/* FIXME: Setting thread priority does not seem to be supported */
|
||||
return 0;
|
||||
#else
|
||||
|
@@ -71,7 +71,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex)
|
||||
/* Lock the mutex */
|
||||
int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
SceInt32 res = 0;
|
||||
@@ -92,7 +92,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
|
||||
/* Try to lock the mutex */
|
||||
int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
SceInt32 res = 0;
|
||||
@@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
/* Unlock the mutex */
|
||||
int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */
|
||||
{
|
||||
#if defined(SDL_THREADS_DISABLED)
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return 0;
|
||||
#else
|
||||
SceInt32 res = 0;
|
||||
|
Reference in New Issue
Block a user