feature (kernel): Implemented variable numeric_specifiers
This commit is contained in:
parent
547f74758e
commit
49a48c70ca
|
@ -50,12 +50,17 @@ uint64_t variadic_format_size(string_t string, va_list args) {
|
|||
buffer_in++;
|
||||
if (*buffer_in == '.') {
|
||||
buffer_in++;
|
||||
if (*buffer_in == '*') {
|
||||
buffer_in++;
|
||||
numeric_specifier = va_arg(args, uint64_t);
|
||||
} else {
|
||||
while (*buffer_in > '0' && *buffer_in < '9') {
|
||||
numeric_specifier *= 10;
|
||||
numeric_specifier += *buffer_in - '0';
|
||||
buffer_in++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(*buffer_in) {
|
||||
case '%': {
|
||||
|
@ -67,8 +72,6 @@ uint64_t variadic_format_size(string_t string, va_list args) {
|
|||
uint64_t strlen = string_length(va_arg(args, string_t));
|
||||
if (numeric_specifier > 0) {
|
||||
strlen = MIN(strlen, numeric_specifier);
|
||||
} else {
|
||||
strlen = numeric_specifier;
|
||||
}
|
||||
|
||||
length += strlen;
|
||||
|
@ -176,12 +179,17 @@ void variadic_format(string_t output, string_t string, va_list args) {
|
|||
buffer_in++;
|
||||
if (*buffer_in == '.') {
|
||||
buffer_in++;
|
||||
if (*buffer_in == '*') {
|
||||
buffer_in++;
|
||||
numeric_specifier = va_arg(args, uint64_t);
|
||||
} else {
|
||||
while (*buffer_in > '0' && *buffer_in < '9') {
|
||||
numeric_specifier *= 10;
|
||||
numeric_specifier += *buffer_in - '0';
|
||||
buffer_in++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(*buffer_in) {
|
||||
case '%': {
|
||||
|
@ -196,8 +204,6 @@ void variadic_format(string_t output, string_t string, va_list args) {
|
|||
|
||||
if (numeric_specifier > 0) {
|
||||
strlen = MIN(strlen, numeric_specifier);
|
||||
} else {
|
||||
strlen = numeric_specifier;
|
||||
}
|
||||
|
||||
memory_copy((void*)str, buffer_out, strlen);
|
||||
|
|
Loading…
Reference in New Issue