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:
committed by
Patrick Georgi
parent
564c2191ab
commit
a418414a58
@ -78,7 +78,7 @@ int do_printk(int msg_level, const char *fmt, ...)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IS_ENABLED (CONFIG_VBOOT)
|
#if IS_ENABLED(CONFIG_VBOOT)
|
||||||
void do_printk_va_list(int msg_level, const char *fmt, va_list args)
|
void do_printk_va_list(int msg_level, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
if (!console_log_level(msg_level))
|
if (!console_log_level(msg_level))
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <trace.h>
|
#include <trace.h>
|
||||||
|
|
||||||
struct vsnprintf_context
|
struct vsnprintf_context {
|
||||||
{
|
|
||||||
char *str_buf;
|
char *str_buf;
|
||||||
size_t buf_limit;
|
size_t buf_limit;
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
static int skip_atoi(const char **s)
|
static int skip_atoi(const char **s)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i = 0;
|
||||||
|
|
||||||
while (is_digit(**s))
|
while (is_digit(**s))
|
||||||
i = i*10 + *((*s)++) - '0';
|
i = i*10 + *((*s)++) - '0';
|
||||||
@ -50,8 +50,8 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
|
|||||||
unsigned long long inum, int base, int size, int precision, int type,
|
unsigned long long inum, int base, int size, int precision, int type,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
char c,sign,tmp[66];
|
char c, sign, tmp[66];
|
||||||
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
|
const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||||
int i;
|
int i;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
#ifdef SUPPORT_64BIT_INTS
|
#ifdef SUPPORT_64BIT_INTS
|
||||||
@ -95,20 +95,25 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
|
|||||||
size--;
|
size--;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
if (num == 0)
|
if (num == 0) {
|
||||||
tmp[i++]='0';
|
tmp[i++] = '0';
|
||||||
else while (num != 0){
|
} else {
|
||||||
tmp[i++] = digits[num % base];
|
while (num != 0) {
|
||||||
num /= base;
|
tmp[i++] = digits[num % base];
|
||||||
|
num /= base;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (i > precision)
|
if (i > precision) {
|
||||||
precision = i;
|
precision = i;
|
||||||
|
}
|
||||||
size -= precision;
|
size -= precision;
|
||||||
if (!(type&(ZEROPAD+LEFT)))
|
if (!(type&(ZEROPAD+LEFT))) {
|
||||||
while (size-- > 0)
|
while (size-- > 0)
|
||||||
call_tx(' '), count++;
|
call_tx(' '), count++;
|
||||||
if (sign)
|
}
|
||||||
|
if (sign) {
|
||||||
call_tx(sign), count++;
|
call_tx(sign), count++;
|
||||||
|
}
|
||||||
if (type & SPECIAL) {
|
if (type & SPECIAL) {
|
||||||
if (base == 8)
|
if (base == 8)
|
||||||
call_tx('0'), count++;
|
call_tx('0'), count++;
|
||||||
@ -117,9 +122,10 @@ static int number(void (*tx_byte)(unsigned char byte, void *data),
|
|||||||
call_tx(digits[33]), count++;
|
call_tx(digits[33]), count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(type & LEFT))
|
if (!(type & LEFT)) {
|
||||||
while (size-- > 0)
|
while (size-- > 0)
|
||||||
call_tx(c), count++;
|
call_tx(c), count++;
|
||||||
|
}
|
||||||
while (i < precision--)
|
while (i < precision--)
|
||||||
call_tx('0'), count++;
|
call_tx('0'), count++;
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
@ -147,7 +153,7 @@ int vtxprintf(void (*tx_byte)(unsigned char byte, void *data),
|
|||||||
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
for (count=0; *fmt ; ++fmt) {
|
for (count = 0; *fmt ; ++fmt) {
|
||||||
if (*fmt != '%') {
|
if (*fmt != '%') {
|
||||||
call_tx(*fmt), count++;
|
call_tx(*fmt), count++;
|
||||||
continue;
|
continue;
|
||||||
@ -167,9 +173,9 @@ repeat:
|
|||||||
|
|
||||||
/* get field width */
|
/* get field width */
|
||||||
field_width = -1;
|
field_width = -1;
|
||||||
if (is_digit(*fmt))
|
if (is_digit(*fmt)) {
|
||||||
field_width = skip_atoi(&fmt);
|
field_width = skip_atoi(&fmt);
|
||||||
else if (*fmt == '*') {
|
} else if (*fmt == '*') {
|
||||||
++fmt;
|
++fmt;
|
||||||
/* it's the next argument */
|
/* it's the next argument */
|
||||||
field_width = va_arg(args, int);
|
field_width = va_arg(args, int);
|
||||||
@ -183,15 +189,16 @@ repeat:
|
|||||||
precision = -1;
|
precision = -1;
|
||||||
if (*fmt == '.') {
|
if (*fmt == '.') {
|
||||||
++fmt;
|
++fmt;
|
||||||
if (is_digit(*fmt))
|
if (is_digit(*fmt)) {
|
||||||
precision = skip_atoi(&fmt);
|
precision = skip_atoi(&fmt);
|
||||||
else if (*fmt == '*') {
|
} else if (*fmt == '*') {
|
||||||
++fmt;
|
++fmt;
|
||||||
/* it's the next argument */
|
/* it's the next argument */
|
||||||
precision = va_arg(args, int);
|
precision = va_arg(args, int);
|
||||||
}
|
}
|
||||||
if (precision < 0)
|
if (precision < 0) {
|
||||||
precision = 0;
|
precision = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the conversion qualifier */
|
/* get the conversion qualifier */
|
||||||
@ -229,9 +236,10 @@ repeat:
|
|||||||
|
|
||||||
len = strnlen(s, (size_t)precision);
|
len = strnlen(s, (size_t)precision);
|
||||||
|
|
||||||
if (!(flags & LEFT))
|
if (!(flags & LEFT)) {
|
||||||
while (len < field_width--)
|
while (len < field_width--)
|
||||||
call_tx(' '), count++;
|
call_tx(' '), count++;
|
||||||
|
}
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
call_tx(*s++), count++;
|
call_tx(*s++), count++;
|
||||||
while (len < field_width--)
|
while (len < field_width--)
|
||||||
@ -253,10 +261,10 @@ repeat:
|
|||||||
long long *ip = va_arg(args, long long *);
|
long long *ip = va_arg(args, long long *);
|
||||||
*ip = count;
|
*ip = count;
|
||||||
} else if (qualifier == 'l') {
|
} else if (qualifier == 'l') {
|
||||||
long * ip = va_arg(args, long *);
|
long *ip = va_arg(args, long *);
|
||||||
*ip = count;
|
*ip = count;
|
||||||
} else {
|
} else {
|
||||||
int * ip = va_arg(args, int *);
|
int *ip = va_arg(args, int *);
|
||||||
*ip = count;
|
*ip = count;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user