Cleanup add brace (#6545)

* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line
This commit is contained in:
Sylvain Becker
2022-11-27 17:38:43 +01:00
committed by GitHub
parent 4958dafdc3
commit 6a2200823c
387 changed files with 6094 additions and 4633 deletions

View File

@@ -86,7 +86,7 @@ SDL_CreateCond_cv(void)
/* Relies on CONDITION_VARIABLE_INIT == 0. */
cond = (SDL_cond_cv *) SDL_calloc(1, sizeof(*cond));
if (!cond) {
if (cond == NULL) {
SDL_OutOfMemory();
}
@@ -106,7 +106,7 @@ static int
SDL_CondSignal_cv(SDL_cond * _cond)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -119,7 +119,7 @@ static int
SDL_CondBroadcast_cv(SDL_cond * _cond)
{
SDL_cond_cv *cond = (SDL_cond_cv *)_cond;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
@@ -135,10 +135,10 @@ SDL_CondWaitTimeout_cv(SDL_cond * _cond, SDL_mutex * _mutex, Uint32 ms)
DWORD timeout;
int ret;
if (!cond) {
if (cond == NULL) {
return SDL_InvalidParamError("cond");
}
if (!_mutex) {
if (_mutex == NULL) {
return SDL_InvalidParamError("mutex");
}
@@ -232,7 +232,7 @@ SDL_CreateCond(void)
if (SDL_mutex_impl_active.Type == SDL_MUTEX_INVALID) {
/* The mutex implementation isn't decided yet, trigger it */
SDL_mutex *mutex = SDL_CreateMutex();
if (!mutex) {
if (mutex == NULL) {
return NULL;
}
SDL_DestroyMutex(mutex);

View File

@@ -64,7 +64,7 @@ SDL_CreateMutex_srw(void)
/* Relies on SRWLOCK_INIT == 0. */
mutex = (SDL_mutex_srw *) SDL_calloc(1, sizeof(*mutex));
if (!mutex) {
if (mutex == NULL) {
SDL_OutOfMemory();
}

View File

@@ -118,7 +118,7 @@ SDL_SemTryWait_atom(SDL_sem * _sem)
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
LONG count;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -140,7 +140,7 @@ SDL_SemWait_atom(SDL_sem * _sem)
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
LONG count;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -172,7 +172,7 @@ SDL_SemWaitTimeout_atom(SDL_sem * _sem, Uint32 timeout)
return SDL_SemWait_atom(_sem);
}
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -215,7 +215,7 @@ SDL_SemValue_atom(SDL_sem * _sem)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
if (!sem) {
if (sem == NULL) {
SDL_InvalidParamError("sem");
return 0;
}
@@ -228,7 +228,7 @@ SDL_SemPost_atom(SDL_sem * _sem)
{
SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -309,7 +309,7 @@ SDL_SemWaitTimeout_kern(SDL_sem * _sem, Uint32 timeout)
int retval;
DWORD dwMilliseconds;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
@@ -350,7 +350,7 @@ static Uint32
SDL_SemValue_kern(SDL_sem * _sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
if (!sem) {
if (sem == NULL) {
SDL_InvalidParamError("sem");
return 0;
}
@@ -361,7 +361,7 @@ static int
SDL_SemPost_kern(SDL_sem * _sem)
{
SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
if (!sem) {
if (sem == NULL) {
return SDL_InvalidParamError("sem");
}
/* Increase the counter in the first place, because
@@ -418,7 +418,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
pWaitOnAddress = (pfnWaitOnAddress) GetProcAddress(synch120, "WaitOnAddress");
pWakeByAddressSingle = (pfnWakeByAddressSingle) GetProcAddress(synch120, "WakeByAddressSingle");
if(pWaitOnAddress && pWakeByAddressSingle) {
if (pWaitOnAddress && pWakeByAddressSingle) {
impl = &SDL_sem_impl_atom;
}
}

View File

@@ -76,7 +76,7 @@ RunThreadViaCreateThread(LPVOID data)
static unsigned __stdcall
RunThreadViaBeginThreadEx(void *data)
{
return (unsigned) RunThread(data);
return (unsigned)RunThread(data);
}
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
@@ -187,7 +187,7 @@ SDL_SYS_SetupThread(const char *name)
SDL_threadID
SDL_ThreadID(void)
{
return ((SDL_threadID) GetCurrentThreadId());
return (SDL_threadID)GetCurrentThreadId();
}
int