diff options
author | Russ Cox <[email protected]> | 2011-01-11 13:01:13 -0500 |
---|---|---|
committer | Russ Cox <[email protected]> | 2011-01-11 13:01:13 -0500 |
commit | 1a81e38b17144624415d252a521fd5a06079d681 (patch) | |
tree | ea7d895bcf77aa25861c09ee490488b6f729e0f3 /console.c | |
parent | 240679608cd46649d1144408f28f83141f9f3a86 (diff) | |
download | xv6-labs-1a81e38b17144624415d252a521fd5a06079d681.tar.gz xv6-labs-1a81e38b17144624415d252a521fd5a06079d681.tar.bz2 xv6-labs-1a81e38b17144624415d252a521fd5a06079d681.zip |
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.
Diffstat (limited to 'console.c')
-rw-r--r-- | console.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); |