mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 06:45:59 +00:00
Updated source to match SDL function prototype style
This commit is contained in:
@@ -26,8 +26,7 @@
|
||||
#include "SDL_systhread.h"
|
||||
#include "../SDL_error_c.h"
|
||||
|
||||
SDL_TLSID
|
||||
SDL_TLSCreate(void)
|
||||
SDL_TLSID SDL_TLSCreate(void)
|
||||
{
|
||||
static SDL_AtomicInt SDL_tls_id;
|
||||
return SDL_AtomicIncRef(&SDL_tls_id) + 1;
|
||||
@@ -112,8 +111,7 @@ typedef struct SDL_TLSEntry
|
||||
static SDL_Mutex *SDL_generic_TLS_mutex;
|
||||
static SDL_TLSEntry *SDL_generic_TLS;
|
||||
|
||||
SDL_TLSData *
|
||||
SDL_Generic_GetTLSData(void)
|
||||
SDL_TLSData *SDL_Generic_GetTLSData(void)
|
||||
{
|
||||
SDL_threadID thread = SDL_ThreadID();
|
||||
SDL_TLSEntry *entry;
|
||||
@@ -215,8 +213,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data)
|
||||
#endif
|
||||
|
||||
/* Routine to get the thread-specific error variable */
|
||||
SDL_error *
|
||||
SDL_GetErrBuf(void)
|
||||
SDL_error *SDL_GetErrBuf(void)
|
||||
{
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
return SDL_GetStaticErrBuf();
|
||||
@@ -317,14 +314,12 @@ void SDL_RunThread(SDL_Thread *thread)
|
||||
#endif
|
||||
|
||||
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
SDL_Thread *
|
||||
SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
|
||||
SDL_Thread *SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
|
||||
const char *name, const size_t stacksize, void *data,
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
pfnSDL_CurrentEndThread pfnEndThread)
|
||||
#else
|
||||
SDL_Thread *
|
||||
SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
|
||||
SDL_Thread *SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
|
||||
const char *name, const size_t stacksize, void *data)
|
||||
#endif
|
||||
{
|
||||
@@ -372,14 +367,12 @@ SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
|
||||
}
|
||||
|
||||
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
DECLSPEC SDL_Thread *SDLCALL
|
||||
SDL_CreateThread(int(SDLCALL *fn)(void *),
|
||||
DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int(SDLCALL *fn)(void *),
|
||||
const char *name, void *data,
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
pfnSDL_CurrentEndThread pfnEndThread)
|
||||
#else
|
||||
DECLSPEC SDL_Thread *SDLCALL
|
||||
SDL_CreateThread(int(SDLCALL *fn)(void *),
|
||||
DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int(SDLCALL *fn)(void *),
|
||||
const char *name, void *data)
|
||||
#endif
|
||||
{
|
||||
@@ -405,8 +398,7 @@ SDL_CreateThread(int(SDLCALL *fn)(void *),
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_Thread *
|
||||
SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name,
|
||||
SDL_Thread *SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name,
|
||||
const size_t stacksize, void *data)
|
||||
{
|
||||
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
@@ -416,8 +408,7 @@ SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name,
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_threadID
|
||||
SDL_GetThreadID(SDL_Thread *thread)
|
||||
SDL_threadID SDL_GetThreadID(SDL_Thread *thread)
|
||||
{
|
||||
SDL_threadID id;
|
||||
|
||||
@@ -429,8 +420,7 @@ SDL_GetThreadID(SDL_Thread *thread)
|
||||
return id;
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GetThreadName(SDL_Thread *thread)
|
||||
const char *SDL_GetThreadName(SDL_Thread *thread)
|
||||
{
|
||||
if (thread) {
|
||||
return thread->name;
|
||||
|
@@ -50,8 +50,7 @@ typedef struct SDL_cond_generic
|
||||
} SDL_cond_generic;
|
||||
|
||||
/* Create a condition variable */
|
||||
SDL_Condition *
|
||||
SDL_CreateCondition_generic(void)
|
||||
SDL_Condition *SDL_CreateCondition_generic(void)
|
||||
{
|
||||
SDL_cond_generic *cond;
|
||||
|
||||
|
@@ -32,8 +32,7 @@ struct SDL_Mutex
|
||||
};
|
||||
|
||||
/* Create a mutex */
|
||||
SDL_Mutex *
|
||||
SDL_CreateMutex(void)
|
||||
SDL_Mutex *SDL_CreateMutex(void)
|
||||
{
|
||||
SDL_Mutex *mutex;
|
||||
|
||||
|
@@ -26,8 +26,7 @@
|
||||
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
|
||||
SDL_Semaphore *
|
||||
SDL_CreateSemaphore(Uint32 initial_value)
|
||||
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_SetError("SDL not built with thread support");
|
||||
return (SDL_Semaphore *)0;
|
||||
@@ -62,8 +61,7 @@ struct SDL_Semaphore
|
||||
SDL_Condition *count_nonzero;
|
||||
};
|
||||
|
||||
SDL_Semaphore *
|
||||
SDL_CreateSemaphore(Uint32 initial_value)
|
||||
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_Semaphore *sem;
|
||||
|
||||
|
@@ -40,8 +40,7 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_threadID
|
||||
SDL_ThreadID(void)
|
||||
SDL_threadID SDL_ThreadID(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@@ -22,8 +22,7 @@
|
||||
#include "SDL_internal.h"
|
||||
#include "../SDL_thread_c.h"
|
||||
|
||||
SDL_TLSData *
|
||||
SDL_SYS_GetTLSData(void)
|
||||
SDL_TLSData *SDL_SYS_GetTLSData(void)
|
||||
{
|
||||
return SDL_Generic_GetTLSData();
|
||||
}
|
||||
|
@@ -32,8 +32,7 @@ struct SDL_Condition
|
||||
};
|
||||
|
||||
/* Create a condition variable */
|
||||
SDL_Condition *
|
||||
SDL_CreateCondition(void)
|
||||
SDL_Condition *SDL_CreateCondition(void)
|
||||
{
|
||||
SDL_Condition *cond = (SDL_Condition *)SDL_malloc(sizeof(SDL_Condition));
|
||||
if (cond) {
|
||||
|
@@ -27,8 +27,7 @@
|
||||
#include "SDL_sysmutex_c.h"
|
||||
|
||||
/* Create a mutex */
|
||||
SDL_Mutex *
|
||||
SDL_CreateMutex(void)
|
||||
SDL_Mutex *SDL_CreateMutex(void)
|
||||
{
|
||||
SDL_Mutex *mutex;
|
||||
|
||||
|
@@ -67,8 +67,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t
|
||||
GetStackSize(size_t requested_size)
|
||||
static size_t GetStackSize(size_t requested_size)
|
||||
{
|
||||
if (requested_size == 0) {
|
||||
return N3DS_THREAD_STACK_SIZE_DEFAULT;
|
||||
@@ -90,8 +89,7 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_threadID
|
||||
SDL_ThreadID(void)
|
||||
SDL_threadID SDL_ThreadID(void)
|
||||
{
|
||||
u32 thread_ID = 0;
|
||||
svcGetThreadId(&thread_ID, CUR_THREAD_HANDLE);
|
||||
|
@@ -39,8 +39,7 @@ static TInt NewMutex(const TDesC &aName, TAny *aPtr1, TAny *)
|
||||
}
|
||||
|
||||
/* Create a mutex */
|
||||
SDL_Mutex *
|
||||
SDL_CreateMutex(void)
|
||||
SDL_Mutex *SDL_CreateMutex(void)
|
||||
{
|
||||
RMutex rmutex;
|
||||
|
||||
@@ -83,8 +82,7 @@ int SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn
|
||||
|
||||
/* Try to lock the mutex */
|
||||
#if 0
|
||||
int
|
||||
SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
int SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
{
|
||||
if (mutex == NULL)
|
||||
{
|
||||
|
@@ -75,8 +75,7 @@ static void WaitAll(SDL_Semaphore *sem)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Semaphore *
|
||||
SDL_CreateSemaphore(Uint32 initial_value)
|
||||
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
RSemaphore s;
|
||||
TInt status = CreateUnique(NewSema, &s, &initial_value);
|
||||
|
@@ -78,8 +78,7 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_threadID
|
||||
SDL_ThreadID(void)
|
||||
SDL_threadID SDL_ThreadID(void)
|
||||
{
|
||||
RThread current;
|
||||
TThreadId id = current.Id();
|
||||
|
@@ -38,8 +38,7 @@ struct SDL_Condition
|
||||
};
|
||||
|
||||
/* Create a condition variable */
|
||||
SDL_Condition *
|
||||
SDL_CreateCondition(void)
|
||||
SDL_Condition *SDL_CreateCondition(void)
|
||||
{
|
||||
SDL_Condition *cond;
|
||||
|
||||
|
@@ -37,8 +37,7 @@ struct SDL_Mutex
|
||||
};
|
||||
|
||||
/* Create a mutex */
|
||||
SDL_Mutex *
|
||||
SDL_CreateMutex(void)
|
||||
SDL_Mutex *SDL_CreateMutex(void)
|
||||
{
|
||||
SDL_Mutex *mutex = NULL;
|
||||
SceInt32 res = 0;
|
||||
|
@@ -34,8 +34,7 @@ struct SDL_Condition
|
||||
};
|
||||
|
||||
/* Create a condition variable */
|
||||
SDL_Condition *
|
||||
SDL_CreateCondition(void)
|
||||
SDL_Condition *SDL_CreateCondition(void)
|
||||
{
|
||||
SDL_Condition *cond;
|
||||
|
||||
|
@@ -25,8 +25,7 @@
|
||||
|
||||
#include "SDL_sysmutex_c.h"
|
||||
|
||||
SDL_Mutex *
|
||||
SDL_CreateMutex(void)
|
||||
SDL_Mutex *SDL_CreateMutex(void)
|
||||
{
|
||||
SDL_Mutex *mutex;
|
||||
pthread_mutexattr_t attr;
|
||||
|
@@ -29,8 +29,7 @@ struct SDL_RWLock
|
||||
};
|
||||
|
||||
|
||||
SDL_RWLock *
|
||||
SDL_CreateRWLock(void)
|
||||
SDL_RWLock *SDL_CreateRWLock(void)
|
||||
{
|
||||
SDL_RWLock *rwlock;
|
||||
|
||||
|
@@ -39,8 +39,7 @@ struct SDL_Semaphore
|
||||
};
|
||||
|
||||
/* Create a semaphore, initialized with value */
|
||||
SDL_Semaphore *
|
||||
SDL_CreateSemaphore(Uint32 initial_value)
|
||||
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_Semaphore *sem = (SDL_Semaphore *)SDL_malloc(sizeof(SDL_Semaphore));
|
||||
if (sem != NULL) {
|
||||
|
@@ -168,8 +168,7 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_threadID
|
||||
SDL_ThreadID(void)
|
||||
SDL_threadID SDL_ThreadID(void)
|
||||
{
|
||||
return (SDL_threadID)pthread_self();
|
||||
}
|
||||
|
@@ -29,8 +29,7 @@
|
||||
static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY;
|
||||
static SDL_bool generic_local_storage = SDL_FALSE;
|
||||
|
||||
SDL_TLSData *
|
||||
SDL_SYS_GetTLSData(void)
|
||||
SDL_TLSData *SDL_SYS_GetTLSData(void)
|
||||
{
|
||||
if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) {
|
||||
static SDL_SpinLock lock;
|
||||
|
@@ -38,8 +38,7 @@ struct SDL_Condition
|
||||
};
|
||||
|
||||
/* Create a condition variable */
|
||||
SDL_Condition *
|
||||
SDL_CreateCondition(void)
|
||||
SDL_Condition *SDL_CreateCondition(void)
|
||||
{
|
||||
SDL_Condition *cond;
|
||||
|
||||
|
@@ -33,8 +33,7 @@ struct SDL_Mutex
|
||||
};
|
||||
|
||||
/* Create a mutex */
|
||||
SDL_Mutex *
|
||||
SDL_CreateMutex(void)
|
||||
SDL_Mutex *SDL_CreateMutex(void)
|
||||
{
|
||||
SDL_Mutex *mutex = NULL;
|
||||
SceInt32 res = 0;
|
||||
|
@@ -206,8 +206,7 @@ static const SDL_cond_impl_t SDL_cond_impl_generic = {
|
||||
};
|
||||
#endif
|
||||
|
||||
SDL_Condition *
|
||||
SDL_CreateCondition(void)
|
||||
SDL_Condition *SDL_CreateCondition(void)
|
||||
{
|
||||
if (SDL_cond_impl_active.Create == NULL) {
|
||||
const SDL_cond_impl_t *impl = NULL;
|
||||
|
@@ -220,8 +220,7 @@ static const SDL_mutex_impl_t SDL_mutex_impl_cs = {
|
||||
* Runtime selection and redirection
|
||||
*/
|
||||
|
||||
SDL_Mutex *
|
||||
SDL_CreateMutex(void)
|
||||
SDL_Mutex *SDL_CreateMutex(void)
|
||||
{
|
||||
if (SDL_mutex_impl_active.Create == NULL) {
|
||||
/* Default to fallback implementation */
|
||||
|
@@ -328,8 +328,7 @@ static const SDL_sem_impl_t SDL_sem_impl_kern = {
|
||||
* Runtime selection and redirection
|
||||
*/
|
||||
|
||||
SDL_Semaphore *
|
||||
SDL_CreateSemaphore(Uint32 initial_value)
|
||||
SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
if (SDL_sem_impl_active.Create == NULL) {
|
||||
/* Default to fallback implementation */
|
||||
|
@@ -162,8 +162,7 @@ void SDL_SYS_SetupThread(const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_threadID
|
||||
SDL_ThreadID(void)
|
||||
SDL_threadID SDL_ThreadID(void)
|
||||
{
|
||||
return (SDL_threadID)GetCurrentThreadId();
|
||||
}
|
||||
|
@@ -42,8 +42,7 @@
|
||||
static DWORD thread_local_storage = TLS_OUT_OF_INDEXES;
|
||||
static SDL_bool generic_local_storage = SDL_FALSE;
|
||||
|
||||
SDL_TLSData *
|
||||
SDL_SYS_GetTLSData(void)
|
||||
SDL_TLSData *SDL_SYS_GetTLSData(void)
|
||||
{
|
||||
if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) {
|
||||
static SDL_SpinLock lock;
|
||||
|
Reference in New Issue
Block a user