Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0327/4

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


remove non-idiomatic while(1) loops in native programs
 [rsc] --rw-rw-r-- M 1276246 glenda sys 4063 Mar 27 08:25 sys/src/cmd/auth/secstore/aescbc.c
	/n/sourcesdump/2006/0327/plan9/sys/src/cmd/auth/secstore/aescbc.c:100,106 - 
	/n/sourcesdump/2006/0328/plan9/sys/src/cmd/auth/secstore/aescbc.c:100,106
	  		aesCBCencrypt(buf+AESbsize, AESbsize, &aes);  /* use second AESbsize bytes as initial plaintext */
	  		safewrite(buf, 2*AESbsize);
	  		dstate = hmac_sha1(buf+AESbsize, AESbsize, key2, MD5dlen, 0, 0);
	- 		while(1){
	+ 		for(;;){
	  			n = Bread(&bin, buf, BUF);
	  			if(n < 0)
	  				sysfatal("read error");
 [rsc] --rw-rw-r-- M 1276246 glenda sys 12678 Mar 27 08:24 sys/src/cmd/auth/secstore/secstore.c
	/n/sourcesdump/2006/0327/plan9/sys/src/cmd/auth/secstore/secstore.c:406,412 - 
	/n/sourcesdump/2006/0328/plan9/sys/src/cmd/auth/secstore/secstore.c:406,412
	  		}
	  		strecpy(c->pass, c->pass+sizeof c->pass, s);
	  	}
	- 	while(1){
	+ 	for(;;){
	  		if(verbose)
	  			fprint(2, "dialing %s\n", dest);
	  		if((fd = dial(dest, nil, nil, nil)) < 0){
 [rsc] --rw-rw-r-- M 1276246 glenda sys 5136 Mar 27 08:24 sys/src/cmd/auth/secstore/secuser.c
	/n/sourcesdump/2006/0327/plan9/sys/src/cmd/auth/secstore/secuser.c:225,231 - 
	/n/sourcesdump/2006/0328/plan9/sys/src/cmd/auth/secstore/secuser.c:225,231
	  {
	  	int n;
	  
	- 	while(1){
	+ 	for(;;){
	  		n = read(0, buf, blen);
	  		if(n<=0)
	  			exits("read error");
 [rsc] --rw-rw-r-- M 1276246 glenda sys 6312 Mar 27 08:23 sys/src/cmd/ip/httpd/hints.c
	/n/sourcesdump/2006/0327/plan9/sys/src/cmd/ip/httpd/hints.c:51,57 - 
	/n/sourcesdump/2006/0328/plan9/sys/src/cmd/ip/httpd/hints.c:51,57
	  
	  	hash = 1 + url%(URLmax-1);
	  	j = urlhash[hash];
	- 	while(1){
	+ 	for(;;){
	  		if(j==0)
	  			return -hash;
	  		if(url==urltab[j])
	/n/sourcesdump/2006/0327/plan9/sys/src/cmd/ip/httpd/hints.c:185,191 - 
	/n/sourcesdump/2006/0328/plan9/sys/src/cmd/ip/httpd/hints.c:185,191
	  	}
	  	arena = (Hint*)ezalloc((filelen/3)*sizeof(Hint));
	  	oldarena = arena;
	- 	while(1){
	+ 	for(;;){
	  		i = Bread(b,buf,3);
	  		if(i<3)
	  			break;
 [rsc] --rw-rw-r-- M 1276246 glenda sys 59909 Mar 27 08:23 sys/src/cmd/ip/ppp/ppp.c
	/n/sourcesdump/2006/0327/plan9/sys/src/cmd/ip/ppp/ppp.c:2554,2560 - 
	/n/sourcesdump/2006/0328/plan9/sys/src/cmd/ip/ppp/ppp.c:2554,2560
	  
	  		p = buf;
	  		lineno = 0;
	- 		while (1) {
	+ 		for(;;) {
	  			char *_args[3];
	  
	  			if ((s = strchr(p, '\n')) == nil)


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].