diff options
author | Ayrton Munoz <ayrton@google.com> | 2022-07-18 15:34:33 -0400 |
---|---|---|
committer | Ayrton Munoz <ayrton@google.com> | 2022-09-23 15:37:56 -0400 |
commit | 0f694f056051903529ebecd0978f260ff85bf268 (patch) | |
tree | 90ed42251ea52bcf2067870b04838325fdfb4b1a /lib | |
parent | 68e04bfc9a24760c3efe6ca6342ec3d2d38db1c2 (diff) | |
download | common-0f694f056051903529ebecd0978f260ff85bf268.tar.gz |
lib/libc: Make vfprintf definition match musl
Musl's stdio.h defines `vfprintf` as an inline function that
calls `vfprintf_worker` with a fourth argument that
determines whether address-like values should be printed or
not. To use musl for the kernel, this commit renames the
`vfprintf` definition in stdio.c to `vfprintf_worker` and
changes the function signature to match musl.
Bug: 230134581
Change-Id: I94dd4100c06b0a23d55a0ccdbcd3e2dee4f40a10
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/include/stdio.h | 5 | ||||
-rw-r--r-- | lib/libc/stdio.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/include/stdio.h b/lib/libc/include/stdio.h index 01315da5..3ef8932e 100644 --- a/lib/libc/include/stdio.h +++ b/lib/libc/include/stdio.h @@ -68,7 +68,10 @@ int printf(const char *fmt, ...) __PRINTFLIKE(1, 2); int vprintf(const char *fmt, va_list ap); int fprintf(FILE *fp, const char *fmt, ...) __PRINTFLIKE(2, 3); -int vfprintf(FILE *fp, const char *fmt, va_list ap); +int vfprintf_worker(FILE *fp, const char *fmt, va_list ap, int filtered_on_release); +static inline int vfprintf(FILE *fp, const char *fmt, va_list ap) { + return vfprintf_worker(fp, fmt, ap, 1); +} int sprintf(char *str, const char *fmt, ...) __PRINTFLIKE(2, 3); int snprintf(char *str, size_t len, const char *fmt, ...) __PRINTFLIKE(3, 4); diff --git a/lib/libc/stdio.c b/lib/libc/stdio.c index e9ee106d..8b41bf6c 100644 --- a/lib/libc/stdio.c +++ b/lib/libc/stdio.c @@ -108,7 +108,7 @@ static int _fprintf_output_func(const char *str, size_t len, void *state) return io_write(fp->io, str, len); } -int vfprintf(FILE *fp, const char *fmt, va_list ap) +int vfprintf_worker(FILE *fp, const char *fmt, va_list ap, int filtered_on_release) { io_lock(fp->io); int result = _printf_engine(&_fprintf_output_func, (void *)fp, fmt, ap); |