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:
@@ -28,14 +28,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <timer_alarm.h>
|
||||
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
@@ -45,12 +46,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) {
|
||||
|
||||
@@ -31,7 +31,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;
|
||||
|
||||
@@ -67,18 +68,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");
|
||||
@@ -86,8 +86,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);
|
||||
@@ -100,7 +100,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)
|
||||
@@ -129,7 +129,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
|
||||
value = 50;
|
||||
}
|
||||
|
||||
return ChangeThreadPriority(GetThreadId(),value);
|
||||
return ChangeThreadPriority(GetThreadId(), value);
|
||||
}
|
||||
|
||||
#endif /* SDL_THREAD_PS2 */
|
||||
|
||||
Reference in New Issue
Block a user