diff options
author | Ryan Prichard <rprichard@google.com> | 2018-10-02 18:13:28 -0700 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2018-10-08 13:27:16 -0700 |
commit | 5de9a31c058dca200c8e11b17d7a78ee0b27699b (patch) | |
tree | 00018fd10f34bd8ad4ba7d9f3e4ace9c48b218bb /libc/async_safe/async_safe_log.cpp | |
parent | 269bb496c56dcf268831e02df035040162f30590 (diff) |
Add async_safe_format_fd_va_list
Bug: none
Test: bionic unit tests
Change-Id: I8c6b2d1d118f4182dd7bf1cbfba78f20b3cefc79
Diffstat (limited to 'libc/async_safe/async_safe_log.cpp')
-rw-r--r-- | libc/async_safe/async_safe_log.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libc/async_safe/async_safe_log.cpp b/libc/async_safe/async_safe_log.cpp index 5f22c7495..207035a15 100644 --- a/libc/async_safe/async_safe_log.cpp +++ b/libc/async_safe/async_safe_log.cpp @@ -424,13 +424,18 @@ int async_safe_format_buffer(char* buffer, size_t buffer_size, const char* forma return buffer_len; } -int async_safe_format_fd(int fd, const char* format, ...) { +int async_safe_format_fd_va_list(int fd, const char* format, va_list args) { FdOutputStream os(fd); + out_vformat(os, format, args); + return os.total; +} + +int async_safe_format_fd(int fd, const char* format, ...) { va_list args; va_start(args, format); - out_vformat(os, format, args); + int result = async_safe_format_fd_va_list(fd, format, args); va_end(args); - return os.total; + return result; } static int write_stderr(const char* tag, const char* msg) { |