Compare commits

...

2 commits

Author SHA1 Message Date
Imbus
9b339273bb Fixing broken loop formatting 2024-08-07 16:07:20 +02:00
Imbus
fbfb728b8f Allow body-less loops on a single line 2024-08-07 16:07:05 +02:00
9 changed files with 17 additions and 32 deletions

View file

@ -44,7 +44,7 @@ AlignTrailingComments:
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true

View file

@ -28,8 +28,7 @@ main()
__sync_synchronize();
started = 1;
} else {
while(started == 0)
;
while(started == 0) {}
__sync_synchronize();
printf("hart %d starting\n", cpuid());
kvminithart(); // turn on paging

View file

@ -123,8 +123,7 @@ panic(char *s)
printf(s);
printf("\n");
panicked = 1; // freeze uart output from other CPUs
for(;;)
;
for(;;) {}
}
void

View file

@ -60,9 +60,8 @@ acquire(struct spinlock *lk)
if(holding(lk)) // If the lock is already held, panic.
panic("acquire");
// See file header for details
while(__sync_lock_test_and_set(&lk->locked, 1) != 0)
;
// Spin until aquired. See file header for details
while(__sync_lock_test_and_set(&lk->locked, 1) != 0) {}
__sync_synchronize(); // No loads/stores after this point
// Record info about lock acquisition for holding() and debugging.

View file

@ -73,8 +73,7 @@ strncpy(char *s, const char *t, int n)
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
;
while(n-- > 0 && (*s++ = *t++) != 0) {}
while(n-- > 0)
*s++ = 0;
return os;
@ -89,8 +88,7 @@ safestrcpy(char *s, const char *t, int n)
os = s;
if(n <= 0)
return os;
while(--n > 0 && (*s++ = *t++) != 0)
;
while(--n > 0 && (*s++ = *t++) != 0) {}
*s = 0;
return os;
}
@ -100,7 +98,6 @@ strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
;
for(n = 0; s[n]; n++) {}
return n;
}

View file

@ -89,8 +89,7 @@ uartputc(int c)
acquire(&uart_tx_lock);
if(panicked) {
for(;;)
;
for(;;) {}
}
while(uart_tx_w == uart_tx_r + UART_TX_BUF_SIZE) {
// buffer is full.
@ -113,13 +112,11 @@ uartputc_sync(int c)
push_off();
if(panicked) {
for(;;)
;
for(;;) {}
}
// wait for Transmit Holding Empty to be set in LSR.
while((ReadReg(LSR) & LSR_TX_IDLE) == 0)
;
while((ReadReg(LSR) & LSR_TX_IDLE) == 0) {}
WriteReg(THR, c);
pop_off();

View file

@ -10,8 +10,7 @@ fmtname(char *path)
char *p;
// Find first character after last slash.
for(p = path + strlen(path); p >= path && *p != '/'; p--)
;
for(p = path + strlen(path); p >= path && *p != '/'; p--) {}
p++;
// Return blank-padded name.

View file

@ -20,8 +20,7 @@ strcpy(char *s, const char *t)
char *os;
os = s;
while((*s++ = *t++) != 0)
;
while((*s++ = *t++) != 0) {}
return os;
}
@ -38,8 +37,7 @@ strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
;
for(n = 0; s[n]; n++) {}
return n;
}

View file

@ -823,8 +823,7 @@ preempt(char *s)
exit(1);
}
if(pid1 == 0)
for(;;)
;
for(;;) {}
pid2 = fork();
if(pid2 < 0) {
@ -832,8 +831,7 @@ preempt(char *s)
exit(1);
}
if(pid2 == 0)
for(;;)
;
for(;;) {}
pipe(pfds);
pid3 = fork();
@ -846,8 +844,7 @@ preempt(char *s)
if(write(pfds[1], "x", 1) != 1)
printf("%s: preempt write error", s);
close(pfds[1]);
for(;;)
;
for(;;) {}
}
close(pfds[1]);