DO NOT MERGE fdprintf backward compatibility shim.

Fixes LP64 build.

Change-Id: Ic76005cd1f5a55344ea8ee3d070d25631d011037
This commit is contained in:
Elliott Hughes 2014-06-03 14:45:17 -07:00
parent 4832a0961d
commit 430cf1a6c3
2 changed files with 8 additions and 10 deletions

View File

@ -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); 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. // POSIX calls this vdprintf, but LP32 Android had fdprintf instead.
extern "C" int vfdprintf(int fd, const char* fmt, va_list ap) { extern "C" int vfdprintf(int fd, const char* fmt, va_list ap) {
return vdprintf(fd, fmt, ap); return vdprintf(fd, fmt, ap);

View File

@ -253,7 +253,14 @@ int vprintf(const char * __restrict, __va_list)
int dprintf(int, const char * __restrict, ...) __printflike(2, 3); int dprintf(int, const char * __restrict, ...) __printflike(2, 3);
int vdprintf(int, const char * __restrict, __va_list) __printflike(2, 0); 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__ #ifndef __AUDIT__
char* gets(char*) __warnattr("gets is very unsafe; consider using fgets"); char* gets(char*) __warnattr("gets is very unsafe; consider using fgets");