From 1a81e38b17144624415d252a521fd5a06079d681 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 11 Jan 2011 13:01:13 -0500 Subject: 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. --- console.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'console.c') diff --git a/console.c b/console.c index 19b3296..634e9e8 100644 --- a/console.c +++ b/console.c @@ -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); -- cgit v1.2.3