diff options
author | Raphaël Hérouart <rherouart@google.com> | 2023-06-15 16:45:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-06-15 16:45:53 +0000 |
commit | e2350d8b870d4f721ee8a62000a71c6975d186d8 (patch) | |
tree | 1062a7405e46e614c839e9afa0fb71609fd88b48 /lib | |
parent | fe29d82177f010e149cec97f22cf83b3129aebf5 (diff) | |
download | common-e2350d8b870d4f721ee8a62000a71c6975d186d8.tar.gz |
Revert "lib/libc: Update formatting for printf"
This reverts commit fe29d82177f010e149cec97f22cf83b3129aebf5.
Reason for revert: because of non-compliant stdlib not having abs?
Change-Id: I4499b738e4a3a4618f71220bf3869746ac1da093
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/printf.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/libc/printf.c b/lib/libc/printf.c index a8b18ea5..9723196e 100644 --- a/lib/libc/printf.c +++ b/lib/libc/printf.c @@ -26,7 +26,6 @@ #include <stdarg.h> #include <sys/types.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #ifdef UTEST_BUILD @@ -115,13 +114,10 @@ int vsnprintf(char *str, size_t len, const char *fmt, va_list ap) args.pos = 0; wlen = _printf_unfiltered_engine(&_vsnprintf_output, (void *)&args, fmt, ap); - if(len > 0) { - if (args.pos >= len) - str[len-1] = '\0'; - else - str[wlen] = '\0'; - } - + if (args.pos >= len) + str[len-1] = '\0'; + else + str[wlen] = '\0'; return wlen; } @@ -568,16 +564,6 @@ next_format: uc = va_arg(ap, unsigned int); OUTPUT_CHAR(uc); break; - case '*': - { - /* indirect format */ - int f = va_arg(ap, int); - format_num = (unsigned int) abs(f); - if(f < 0) { - flags |= LEFTFORMATFLAG; - } - goto next_format; - } case 's': s = va_arg(ap, const char *); if (s == 0) |