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:
Sam Lantinga
2022-11-30 12:51:59 -08:00
committed by GitHub
parent 14b902faca
commit 5750bcb174
781 changed files with 51659 additions and 55763 deletions

View File

@@ -40,7 +40,7 @@ SDL_CreateMutex(void)
SceInt32 res = 0;
/* Allocate mutex memory */
mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex));
if (mutex != NULL) {
res = sceKernelCreateLwMutex(
@@ -48,8 +48,7 @@ SDL_CreateMutex(void)
"SDL mutex",
SCE_KERNEL_MUTEX_ATTR_RECURSIVE,
0,
NULL
);
NULL);
if (res < 0) {
SDL_SetError("Error trying to create mutex: %x", res);
@@ -61,8 +60,7 @@ SDL_CreateMutex(void)
}
/* Free the mutex */
void
SDL_DestroyMutex(SDL_mutex * mutex)
void SDL_DestroyMutex(SDL_mutex *mutex)
{
if (mutex != NULL) {
sceKernelDeleteLwMutex(&mutex->lock);
@@ -71,8 +69,7 @@ SDL_DestroyMutex(SDL_mutex * mutex)
}
/* Try to lock the mutex */
int
SDL_TryLockMutex(SDL_mutex * mutex)
int SDL_TryLockMutex(SDL_mutex *mutex)
{
#if SDL_THREADS_DISABLED
return 0;
@@ -84,25 +81,23 @@ SDL_TryLockMutex(SDL_mutex * mutex)
res = sceKernelTryLockLwMutex(&mutex->lock, 1);
switch (res) {
case SCE_KERNEL_OK:
return 0;
break;
case SCE_KERNEL_ERROR_MUTEX_FAILED_TO_OWN:
return SDL_MUTEX_TIMEDOUT;
break;
default:
return SDL_SetError("Error trying to lock mutex: %x", res);
break;
case SCE_KERNEL_OK:
return 0;
break;
case SCE_KERNEL_ERROR_MUTEX_FAILED_TO_OWN:
return SDL_MUTEX_TIMEDOUT;
break;
default:
return SDL_SetError("Error trying to lock mutex: %x", res);
break;
}
return -1;
#endif /* SDL_THREADS_DISABLED */
}
/* Lock the mutex */
int
SDL_mutexP(SDL_mutex * mutex)
int SDL_mutexP(SDL_mutex *mutex)
{
#if SDL_THREADS_DISABLED
return 0;
@@ -122,8 +117,7 @@ SDL_mutexP(SDL_mutex * mutex)
}
/* Unlock the mutex */
int
SDL_mutexV(SDL_mutex * mutex)
int SDL_mutexV(SDL_mutex *mutex)
{
#if SDL_THREADS_DISABLED
return 0;