diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp index 1284b9a4e..f680fe0d0 100644 --- a/libc/bionic/ndk_cruft.cpp +++ b/libc/bionic/ndk_cruft.cpp @@ -186,15 +186,6 @@ extern "C" intmax_t strntoimax(const char* nptr, char** endptr, int base, size_t 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 c6b2d3226..8f3c525d7 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -253,7 +253,14 @@ int vprintf(const char * __restrict, __va_list) 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");