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

@@ -36,22 +36,23 @@ SDL_unixify_std(const char *ro_path, char *buffer, size_t buf_len, int filetype)
{
const char *const in_buf = buffer; /* = NULL if we allocate the buffer. */
if (!buffer) {
if (buffer == NULL) {
/* This matches the logic in __unixify, with an additional byte for the
* extra path separator.
*/
buf_len = SDL_strlen(ro_path) + 14 + 1;
buffer = SDL_malloc(buf_len);
if (!buffer) {
if (buffer == NULL) {
SDL_OutOfMemory();
return NULL;
}
}
if (!__unixify_std(ro_path, buffer, buf_len, filetype)) {
if (!in_buf)
if (in_buf == NULL) {
SDL_free(buffer);
}
SDL_SetError("Could not convert '%s' to a Unix-style path", ro_path);
return NULL;
@@ -90,7 +91,7 @@ canonicalisePath(const char *path, const char *pathVar)
regs.r[5] = 1 - regs.r[5];
buf = SDL_malloc(regs.r[5]);
if (!buf) {
if (buf == NULL) {
SDL_OutOfMemory();
return NULL;
}
@@ -120,8 +121,9 @@ createDirectoryRecursive(char *path)
*ptr = '\0';
error = _kernel_swi(OS_File, &regs, &regs);
*ptr = '.';
if (error != NULL)
if (error != NULL) {
return error;
}
}
}
return _kernel_swi(OS_File, &regs, &regs);
@@ -140,14 +142,15 @@ SDL_GetBasePath(void)
}
canon = canonicalisePath((const char *)regs.r[0], "Run$Path");
if (!canon) {
if (canon == NULL) {
return NULL;
}
/* chop off filename. */
ptr = SDL_strrchr(canon, '.');
if (ptr != NULL)
if (ptr != NULL) {
*ptr = '\0';
}
retval = SDL_unixify_std(canon, NULL, 0, __RISCOSIFY_FILETYPE_NOTSPECIFIED);
SDL_free(canon);
@@ -161,22 +164,22 @@ SDL_GetPrefPath(const char *org, const char *app)
size_t len;
_kernel_oserror *error;
if (!app) {
if (app == NULL) {
SDL_InvalidParamError("app");
return NULL;
}
if (!org) {
if (org == NULL) {
org = "";
}
canon = canonicalisePath("<Choices$Write>", "Run$Path");
if (!canon) {
if (canon == NULL) {
return NULL;
}
len = SDL_strlen(canon) + SDL_strlen(org) + SDL_strlen(app) + 4;
dir = (char *) SDL_malloc(len);
if (!dir) {
if (dir == NULL) {
SDL_OutOfMemory();
SDL_free(canon);
return NULL;