DO NOT MERGE fdprintf backward compatibility shim.
Fixes LP64 build.
Change-Id: Ic76005cd1f5a55344ea8ee3d070d25631d011037
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 1284b9a..f680fe0 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -186,15 +186,6 @@
return (intmax_t) strntoumax(nptr, endptr, base, n);
}
-// POSIX calls this dprintf, but LP32 Android had fdprintf instead.
-extern "C" int fdprintf(int fd, const char* fmt, ...) {
- va_list ap;
- va_start(ap, fmt);
- int rc = vdprintf(fd, fmt, ap);
- va_end(ap);
- return rc;
-}
-
// POSIX calls this vdprintf, but LP32 Android had fdprintf instead.
extern "C" int vfdprintf(int fd, const char* fmt, va_list ap) {
return vdprintf(fd, fmt, ap);
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index c6b2d32..8f3c525 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -253,7 +253,14 @@
int dprintf(int, const char * __restrict, ...) __printflike(2, 3);
int vdprintf(int, const char * __restrict, __va_list) __printflike(2, 0);
-int fdprintf(int, const char * __restrict, ...) __printflike(2, 3); /* Note: this is only in the preview release. */
+static inline int fdprintf(int fd, const char* fmt, ...) {
+ /* Note: this backward compatibility shim is only in the preview release. */
+ va_list ap;
+ va_start(ap, fmt);
+ int rc = vdprintf(fd, fmt, ap);
+ va_end(ap);
+ return rc;
+}
#ifndef __AUDIT__
char* gets(char*) __warnattr("gets is very unsafe; consider using fgets");