mirror of
https://github.com/fluencelabs/musl
synced 2025-05-18 18:21:31 +00:00
since vfprintf will provide a temporary buffer in the case where the target FILE has a zero buffer size, don't bother setting up a real buffer for vdprintf. this also allows us to skip the call to fflush since we know everything will be written out before vfprintf returns.
17 lines
334 B
C
17 lines
334 B
C
#include "stdio_impl.h"
|
|
|
|
static size_t wrap_write(FILE *f, const unsigned char *buf, size_t len)
|
|
{
|
|
return __stdio_write(f, buf, len);
|
|
}
|
|
|
|
int vdprintf(int fd, const char *fmt, va_list ap)
|
|
{
|
|
FILE f = {
|
|
.fd = fd, .lbf = EOF, .write = wrap_write,
|
|
.buf = (void *)fmt, .buf_size = 0,
|
|
.lock = -1
|
|
};
|
|
return vfprintf(&f, fmt, ap);
|
|
}
|