aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRaphaël Hérouart <rherouart@google.com>2023-06-15 16:45:53 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-06-15 16:45:53 +0000
commite2350d8b870d4f721ee8a62000a71c6975d186d8 (patch)
tree1062a7405e46e614c839e9afa0fb71609fd88b48 /lib
parentfe29d82177f010e149cec97f22cf83b3129aebf5 (diff)
downloadcommon-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.c22
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)