make new code like old code

Variable declarations at top of function,
separate from initialization.

Use == 0 instead of ! for checking pointers.

Consistent spacing around {, *, casts.

Declare 0-parameter functions as (void) not ().

Integer valued functions return -1 on failure, 0 on success.
This commit is contained in:
Russ Cox 2011-01-11 13:01:13 -05:00
parent 240679608c
commit 1a81e38b17
21 changed files with 227 additions and 199 deletions

View file

@ -27,15 +27,16 @@ printint(int xx, int base, int sgn)
{
static char digits[] = "0123456789abcdef";
char buf[16];
int i = 0, neg = 0;
int i, neg;
uint x;
if(sgn && xx < 0){
if(sgn && (neg = xx < 0)){
neg = 1;
x = -xx;
} else
x = xx;
i = 0;
do{
buf[i++] = digits[x % base];
}while((x /= base) != 0);