always add braces to control statements and \n at EOF

This commit is contained in:
Furkan Mudanyali 2023-12-27 17:06:41 +03:00
parent 7f0a207220
commit 9dc6b70f19
26 changed files with 40 additions and 32 deletions

View File

@ -40,6 +40,8 @@ IndentGotoLabels: false
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false

View File

@ -41,22 +41,27 @@ unsigned int mbox_call(unsigned char ch) {
unsigned int m = ((unsigned int)((long)&mbox) & ~0xF)
| (ch & 0xF); /* 28-bit address (MSB), 4-bit value (LSB) */
while (1)
if (!(mmio_read(MBOX_STATUS) & MBOX_FULL))
while (1) {
if (!(mmio_read(MBOX_STATUS) & MBOX_FULL)) {
break;
}
}
mmio_write(MBOX_WRITE, m);
while (1) {
while (1)
if (!(mmio_read(MBOX_STATUS) & MBOX_EMPTY))
break; /* Wait for a reply */
while (1) {
if (!(mmio_read(MBOX_STATUS) & MBOX_EMPTY)) {
break; /* Wait for a reply */
}
}
if (m == mmio_read(MBOX_READ)) { /* Look for a message on MBOX_READ */
if (mbox[1] == MBOX_RESPONSE)
if (mbox[1] == MBOX_RESPONSE) {
return 1; /* Success! */
else
} else {
return 0;
}
}
}
return 0;

View File

@ -18,8 +18,9 @@
int strcmp(const char *restrict str1, const char *str2) {
while (*str1 || *str2) {
if (*str1 != *str2)
if (*str1 != *str2) {
return *str1 - *str2;
}
str1++;
str2++;
}