More printf de-duplication.
Fix the 'j' (intmax_t/uintmax_t) length qualifier in the wide
variant. (With new tests that fail without this fix.)
Fix a typo in the wide support for intmax_t*, which isn't testable because
%n is disabled on Android (and will be removed in a later cleanup pass).
Also move the public vfprintf/vfwprint functions into stdio.cpp.
Bug: http://b/67371539
Test: ran tests
Change-Id: Ib003599b1e9cb789044a068940b59e447f2cb7cb
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index c10bc00..46d717a 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -935,6 +935,16 @@
PRINTF_IMPL(vswscanf(s, fmt, ap));
}
+int vfprintf(FILE* fp, const char* fmt, va_list ap) {
+ ScopedFileLock sfl(fp);
+ return __vfprintf(fp, fmt, ap);
+}
+
+int vfwprintf(FILE* fp, const wchar_t* fmt, va_list ap) {
+ ScopedFileLock sfl(fp);
+ return __vfwprintf(fp, fmt, ap);
+}
+
int vprintf(const char* fmt, va_list ap) {
return vfprintf(stdout, fmt, ap);
}