提交 db8fb62e 创建 作者: rsc's avatar rsc

for vs while

上级 236d3369
...@@ -39,7 +39,7 @@ getblk(uint dev, uint sector) ...@@ -39,7 +39,7 @@ getblk(uint dev, uint sector)
acquire(&buf_table_lock); acquire(&buf_table_lock);
while(1){ for(;;){
for(b = bufhead.next; b != &bufhead; b = b->next) for(b = bufhead.next; b != &bufhead; b = b->next)
if((b->flags & (B_BUSY|B_VALID)) && b->dev == dev && b->sector == sector) if((b->flags & (B_BUSY|B_VALID)) && b->dev == dev && b->sector == sector)
break; break;
......
...@@ -58,7 +58,7 @@ cmain(void) ...@@ -58,7 +58,7 @@ cmain(void)
bad: bad:
outw(0x8A00, 0x8A00); outw(0x8A00, 0x8A00);
outw(0x8A00, 0x8E00); outw(0x8A00, 0x8E00);
while(1) for(;;)
; ;
} }
......
...@@ -479,7 +479,7 @@ namei(char *path, int mode, uint *ret_off, char **ret_last, struct inode **ret_i ...@@ -479,7 +479,7 @@ namei(char *path, int mode, uint *ret_off, char **ret_last, struct inode **ret_i
while(*cp == '/') while(*cp == '/')
cp++; cp++;
while(1){ for(;;){
if(*cp == '\0'){ if(*cp == '\0'){
if(mode == NAMEI_LOOKUP) if(mode == NAMEI_LOOKUP)
return dp; return dp;
......
...@@ -20,7 +20,7 @@ main(void) ...@@ -20,7 +20,7 @@ main(void)
dup(0); dup(0);
dup(0); dup(0);
while(1){ for(;;){
pid = fork(); pid = fork();
if(pid < 0){ if(pid < 0){
puts("init: fork failed\n"); puts("init: fork failed\n");
......
...@@ -62,7 +62,7 @@ checkstring(uint s) ...@@ -62,7 +62,7 @@ checkstring(uint s)
char c; char c;
int len = 0; int len = 0;
while(1){ for(;;){
if(fetchbyte(curproc[cpu()], s, &c) < 0) if(fetchbyte(curproc[cpu()], s, &c) < 0)
return -1; return -1;
if(c == '\0') if(c == '\0')
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论