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

(cherry picked from commit 5750bcb174)
This commit is contained in:
Sam Lantinga
2022-11-30 12:51:59 -08:00
parent 5c4bc807f7
commit b8d85c6939
764 changed files with 50598 additions and 54407 deletions

View File

@@ -33,11 +33,13 @@
#include <kernel.h>
struct SDL_semaphore {
s32 semid;
struct SDL_semaphore
{
s32 semid;
};
static void usercb(struct timer_alarm_t *alarm, void *arg) {
static void usercb(struct timer_alarm_t *alarm, void *arg)
{
iReleaseWaitThread((int)arg);
}
@@ -47,12 +49,12 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
SDL_sem *sem;
ee_sema_t sema;
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
if (sem != NULL) {
/* TODO: Figure out the limit on the maximum value. */
sema.init_count = initial_value;
sema.max_count = 255;
sema.option = 0;
sema.max_count = 255;
sema.option = 0;
sem->semid = CreateSema(&sema);
if (sem->semid < 0) {

View File

@@ -33,7 +33,8 @@
#include "../SDL_thread_c.h"
#include <kernel.h>
static void FinishThread(SDL_Thread *thread) {
static void FinishThread(SDL_Thread *thread)
{
ee_thread_status_t info;
int res;
@@ -69,18 +70,17 @@ int SDL_SYS_CreateThread(SDL_Thread *thread)
priority = status.current_priority;
}
stack_size = thread->stacksize ? ((int) thread->stacksize) : 0x1800;
stack_size = thread->stacksize ? ((int)thread->stacksize) : 0x1800;
/* Create EE Thread */
eethread.attr = 0;
eethread.option = 0;
eethread.func = &childThread;
eethread.stack = SDL_malloc(stack_size);
eethread.stack_size = stack_size;
eethread.gp_reg = &_gp;
eethread.initial_priority = priority;
thread->handle = CreateThread(&eethread);
eethread.attr = 0;
eethread.option = 0;
eethread.func = &childThread;
eethread.stack = SDL_malloc(stack_size);
eethread.stack_size = stack_size;
eethread.gp_reg = &_gp;
eethread.initial_priority = priority;
thread->handle = CreateThread(&eethread);
if (thread->handle < 0) {
return SDL_SetError("CreateThread() failed");
@@ -88,8 +88,8 @@ int SDL_SYS_CreateThread(SDL_Thread *thread)
// Prepare el semaphore for the ending function
sema.init_count = 0;
sema.max_count = 1;
sema.option = 0;
sema.max_count = 1;
sema.option = 0;
thread->endfunc = (void *)CreateSema(&sema);
return StartThread(thread->handle, thread);
@@ -102,7 +102,7 @@ void SDL_SYS_SetupThread(const char *name)
SDL_threadID SDL_ThreadID(void)
{
return (SDL_threadID) GetThreadId();
return (SDL_threadID)GetThreadId();
}
void SDL_SYS_WaitThread(SDL_Thread *thread)
@@ -131,7 +131,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
value = 50;
}
return ChangeThreadPriority(GetThreadId(),value);
return ChangeThreadPriority(GetThreadId(), value);
}
#endif /* SDL_THREAD_PS2 */