src/console: Fix coding style

Change-Id: I57724262ade87e7907d31ea66e4f1b9c382ef3db
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/26303
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Elyes HAOUAS
2018-05-15 20:57:01 +02:00
committed by Patrick Georgi
parent 564c2191ab
commit a418414a58
3 changed files with 31 additions and 24 deletions

View File

@ -18,8 +18,7 @@
#include <string.h>
#include <trace.h>
struct vsnprintf_context
{
struct vsnprintf_context {
char *str_buf;
size_t buf_limit;
};

View File

@ -95,20 +95,25 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
size--;
}
i = 0;
if (num == 0)
if (num == 0) {
tmp[i++] = '0';
else while (num != 0){
} else {
while (num != 0) {
tmp[i++] = digits[num % base];
num /= base;
}
if (i > precision)
}
if (i > precision) {
precision = i;
}
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
if (!(type&(ZEROPAD+LEFT))) {
while (size-- > 0)
call_tx(' '), count++;
if (sign)
}
if (sign) {
call_tx(sign), count++;
}
if (type & SPECIAL) {
if (base == 8)
call_tx('0'), count++;
@ -117,9 +122,10 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
call_tx(digits[33]), count++;
}
}
if (!(type & LEFT))
if (!(type & LEFT)) {
while (size-- > 0)
call_tx(c), count++;
}
while (i < precision--)
call_tx('0'), count++;
while (i-- > 0)
@ -167,9 +173,9 @@ repeat:
/* get field width */
field_width = -1;
if (is_digit(*fmt))
if (is_digit(*fmt)) {
field_width = skip_atoi(&fmt);
else if (*fmt == '*') {
} else if (*fmt == '*') {
++fmt;
/* it's the next argument */
field_width = va_arg(args, int);
@ -183,16 +189,17 @@ repeat:
precision = -1;
if (*fmt == '.') {
++fmt;
if (is_digit(*fmt))
if (is_digit(*fmt)) {
precision = skip_atoi(&fmt);
else if (*fmt == '*') {
} else if (*fmt == '*') {
++fmt;
/* it's the next argument */
precision = va_arg(args, int);
}
if (precision < 0)
if (precision < 0) {
precision = 0;
}
}
/* get the conversion qualifier */
qualifier = -1;
@ -229,9 +236,10 @@ repeat:
len = strnlen(s, (size_t)precision);
if (!(flags & LEFT))
if (!(flags & LEFT)) {
while (len < field_width--)
call_tx(' '), count++;
}
for (i = 0; i < len; ++i)
call_tx(*s++), count++;
while (len < field_width--)