print: improve padding

This commit is contained in:
King Kévin 2017-05-06 16:22:25 +02:00
parent f621403d8f
commit b5cc93bfc0
1 changed files with 6 additions and 7 deletions

View File

@ -241,16 +241,15 @@ static size_t vsnprintf(char** str, size_t* size, const char *format, va_list va
// check padding
if ('0'==*format) { // padding required
format++; // go to padding number
padding = 0;
while (*format>='0' && *format<='9') {
padding *= 10; // shift padding digit
padding += *format-'0'; // get next padding digit
format++; // go to next character
}
if (0==*format) { // end of string detected
goto end;
}
if (*format>='0' && *format<='9') {
padding = *format-'0';
format++; // go to format specifier
if (0==*format) { // end of string detected
goto end;
}
}
}
// check format specifier
switch (*format) {