diff options
Diffstat (limited to 'src/common/libc/printf.c')
-rw-r--r-- | src/common/libc/printf.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/common/libc/printf.c b/src/common/libc/printf.c index 68e08d8..8618741 100644 --- a/src/common/libc/printf.c +++ b/src/common/libc/printf.c @@ -69,10 +69,9 @@ int vsnprintf(char *buff, size_t len, const char* format, va_list ap){ } case 'x': { unsigned int hexa = va_arg(ap,int); - unsigned int nb; - int j, had_nonzero = 0; - for(j = 0; j < 8; j++) { - nb = (unsigned int)(hexa << (j*4)); + int had_nonzero = 0; + for(int j = 0; j < 8; j++) { + unsigned int nb = (unsigned int)(hexa << (j*4)); nb = (nb >> 28) & 0xf; // Skip the leading zeros if (nb == 0) { @@ -92,10 +91,8 @@ int vsnprintf(char *buff, size_t len, const char* format, va_list ap){ } case 'p': { unsigned int hexa = va_arg(ap,int); - unsigned int nb; - int j; - for (j = 0; j < 8; j++) { - nb = (unsigned int)(hexa << (j*4)); + for (int j = 0; j < 8; j++) { + unsigned int nb = (unsigned int)(hexa << (j*4)); nb = (nb >> 28) & 0xf; if (nb < 10) PUTCHAR('0'+nb); |