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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
387 changed files with 6094 additions and 4633 deletions

View file

@ -40,7 +40,7 @@ SDL_TLSGet(SDL_TLSID id)
SDL_TLSData *storage;
storage = SDL_SYS_GetTLSData();
if (!storage || id == 0 || id > storage->limit) {
if (storage == NULL || id == 0 || id > storage->limit) {
return NULL;
}
return storage->array[id-1].data;
@ -56,13 +56,13 @@ SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *))
}
storage = SDL_SYS_GetTLSData();
if (!storage || (id > storage->limit)) {
if (storage == NULL || (id > storage->limit)) {
unsigned int i, oldlimit, newlimit;
oldlimit = storage ? storage->limit : 0;
newlimit = (id + TLS_ALLOC_CHUNKSIZE);
storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage)+(newlimit-1)*sizeof(storage->array[0]));
if (!storage) {
if (storage == NULL) {
return SDL_OutOfMemory();
}
storage->limit = newlimit;
@ -125,14 +125,14 @@ SDL_Generic_GetTLSData(void)
SDL_TLSData *storage = NULL;
#if !SDL_THREADS_DISABLED
if (!SDL_generic_TLS_mutex) {
if (SDL_generic_TLS_mutex == NULL) {
static SDL_SpinLock tls_lock;
SDL_AtomicLock(&tls_lock);
if (!SDL_generic_TLS_mutex) {
if (SDL_generic_TLS_mutex == NULL) {
SDL_mutex *mutex = SDL_CreateMutex();
SDL_MemoryBarrierRelease();
SDL_generic_TLS_mutex = mutex;
if (!SDL_generic_TLS_mutex) {
if (SDL_generic_TLS_mutex == NULL) {
SDL_AtomicUnlock(&tls_lock);
return NULL;
}
@ -181,7 +181,7 @@ SDL_Generic_SetTLSData(SDL_TLSData *storage)
}
prev = entry;
}
if (!entry) {
if (entry == NULL) {
entry = (SDL_TLSEntry *)SDL_malloc(sizeof(*entry));
if (entry) {
entry->thread = thread;
@ -192,7 +192,7 @@ SDL_Generic_SetTLSData(SDL_TLSData *storage)
}
SDL_UnlockMutex(SDL_generic_TLS_mutex);
if (!entry) {
if (entry == NULL) {
return SDL_OutOfMemory();
}
return 0;
@ -260,7 +260,7 @@ SDL_GetErrBuf(void)
if (errbuf == ALLOCATION_IN_PROGRESS) {
return SDL_GetStaticErrBuf();
}
if (!errbuf) {
if (errbuf == NULL) {
/* Get the original memory functions for this allocation because the lifetime
* of the error buffer may span calls to SDL_SetMemoryFunctions() by the app
*/
@ -271,7 +271,7 @@ SDL_GetErrBuf(void)
/* Mark that we're in the middle of allocating our buffer */
SDL_TLSSet(tls_errbuf, ALLOCATION_IN_PROGRESS, NULL);
errbuf = (SDL_error *)realloc_func(NULL, sizeof(*errbuf));
if (!errbuf) {
if (errbuf == NULL) {
SDL_TLSSet(tls_errbuf, NULL, NULL);
return SDL_GetStaticErrBuf();
}
@ -472,7 +472,7 @@ SDL_WaitThread(SDL_Thread * thread, int *status)
void
SDL_DetachThread(SDL_Thread * thread)
{
if (!thread) {
if (thread == NULL) {
return;
}