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