style: format kprintf_internal for improved readability
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
40333f1a37
commit
57a21bd4e2
2 changed files with 15 additions and 10 deletions
|
|
@ -137,7 +137,8 @@ void kprintf_internal(const char *format, va_list args)
|
|||
if (*p == '%')
|
||||
{
|
||||
p++;
|
||||
if(*p == '\0') break;
|
||||
if (*p == '\0')
|
||||
break;
|
||||
switch (*p)
|
||||
{
|
||||
case 'c':
|
||||
|
|
@ -149,7 +150,8 @@ void kprintf_internal(const char *format, va_list args)
|
|||
case 's':
|
||||
{
|
||||
char *s = va_arg(args, char *);
|
||||
if (!s) s = "(null)";
|
||||
if (!s)
|
||||
s = "(null)";
|
||||
kprint(s);
|
||||
break;
|
||||
}
|
||||
|
|
@ -159,12 +161,12 @@ void kprintf_internal(const char *format, va_list args)
|
|||
kprint_int(d);
|
||||
break;
|
||||
}
|
||||
case 'u':
|
||||
case 'u':
|
||||
{
|
||||
unsigned int u = va_arg(args, unsigned int);
|
||||
kprint_int((int)u);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 'f':
|
||||
{
|
||||
double f = va_arg(args, double);
|
||||
|
|
@ -174,11 +176,11 @@ void kprintf_internal(const char *format, va_list args)
|
|||
case 'x': // Hex
|
||||
case 'p': // Pointer
|
||||
{
|
||||
#if UINTPTR_MAX == 0xffffffffULL
|
||||
unsigned int x = va_arg(args, unsigned int);
|
||||
#else
|
||||
uint64_t x = va_arg(args, uint64_t);
|
||||
#endif
|
||||
#if UINTPTR_MAX == 0xffffffffULL
|
||||
unsigned int x = va_arg(args, unsigned int);
|
||||
#else
|
||||
uint64_t x = va_arg(args, uint64_t);
|
||||
#endif
|
||||
kprint_hex(x);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,5 +2,8 @@
|
|||
#define STRING_H
|
||||
|
||||
void *memset(void *s, int c, size_t n);
|
||||
void *memcpy(void *dest, const void *src, size_t n);
|
||||
int strcmp(const char *str1, const char *str2);
|
||||
size_t strlen(const char *s);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue