mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 23:31:45 +00:00
Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594
This commit is contained in:
@@ -24,47 +24,41 @@
|
||||
|
||||
#include "SDL_systhread_c.h"
|
||||
|
||||
|
||||
#if SDL_THREADS_DISABLED
|
||||
|
||||
SDL_sem *
|
||||
SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_SetError("SDL not built with thread support");
|
||||
return (SDL_sem *) 0;
|
||||
return (SDL_sem *)0;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_DestroySemaphore(SDL_sem * sem)
|
||||
void SDL_DestroySemaphore(SDL_sem *sem)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SemTryWait(SDL_sem * sem)
|
||||
int SDL_SemTryWait(SDL_sem *sem)
|
||||
{
|
||||
return SDL_SetError("SDL not built with thread support");
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
||||
int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
||||
{
|
||||
return SDL_SetError("SDL not built with thread support");
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SemWait(SDL_sem * sem)
|
||||
int SDL_SemWait(SDL_sem *sem)
|
||||
{
|
||||
return SDL_SetError("SDL not built with thread support");
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_SemValue(SDL_sem * sem)
|
||||
SDL_SemValue(SDL_sem *sem)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SemPost(SDL_sem * sem)
|
||||
int SDL_SemPost(SDL_sem *sem)
|
||||
{
|
||||
return SDL_SetError("SDL not built with thread support");
|
||||
}
|
||||
@@ -84,7 +78,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
SDL_sem *sem;
|
||||
|
||||
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
|
||||
sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
|
||||
if (sem == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
@@ -105,8 +99,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
|
||||
/* WARNING:
|
||||
You cannot call this function when another thread is using the semaphore.
|
||||
*/
|
||||
void
|
||||
SDL_DestroySemaphore(SDL_sem * sem)
|
||||
void SDL_DestroySemaphore(SDL_sem *sem)
|
||||
{
|
||||
if (sem) {
|
||||
sem->count = 0xFFFFFFFF;
|
||||
@@ -124,8 +117,7 @@ SDL_DestroySemaphore(SDL_sem * sem)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SemTryWait(SDL_sem * sem)
|
||||
int SDL_SemTryWait(SDL_sem *sem)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -144,8 +136,7 @@ SDL_SemTryWait(SDL_sem * sem)
|
||||
return retval;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
||||
int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -174,14 +165,13 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
||||
return retval;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SemWait(SDL_sem * sem)
|
||||
int SDL_SemWait(SDL_sem *sem)
|
||||
{
|
||||
return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_SemValue(SDL_sem * sem)
|
||||
SDL_SemValue(SDL_sem *sem)
|
||||
{
|
||||
Uint32 value;
|
||||
|
||||
@@ -194,8 +184,7 @@ SDL_SemValue(SDL_sem * sem)
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SemPost(SDL_sem * sem)
|
||||
int SDL_SemPost(SDL_sem *sem)
|
||||
{
|
||||
if (sem == NULL) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
|
Reference in New Issue
Block a user