diff options
author | Florian Weimer <fweimer@redhat.com> | 2022-08-18 08:49:54 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2022-12-12 15:39:05 +0100 |
commit | a407f0532feffbc31a3fa89754dc2313bd56eb89 (patch) | |
tree | 2f1f677a8e3c023ba0d1bcb88038f45108ad0f8a | |
parent | 2706c12ba5db0ed2c845c991bb1577a7e5be2f07 (diff) | |
download | glibc-a407f0532feffbc31a3fa89754dc2313bd56eb89.zip glibc-a407f0532feffbc31a3fa89754dc2313bd56eb89.tar.gz glibc-a407f0532feffbc31a3fa89754dc2313bd56eb89.tar.bz2 |
stdio-common: Add lock optimization to vfprintf and vfwprintf
After the rewrite and the implicit unbuffered streams handling, this
is very straightforward to add.
-rw-r--r-- | stdio-common/vfprintf-internal.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/stdio-common/vfprintf-internal.c b/stdio-common/vfprintf-internal.c index 83a6aea..23ada8d 100644 --- a/stdio-common/vfprintf-internal.c +++ b/stdio-common/vfprintf-internal.c @@ -1452,6 +1452,14 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap, unsigned int mode_flags) return EOF; #endif + if (!_IO_need_lock (s)) + { + struct Xprintf (buffer_to_file) wrap; + Xprintf (buffer_to_file_init) (&wrap, s); + Xprintf_buffer (&wrap.base, format, ap, mode_flags); + return Xprintf (buffer_to_file_done) (&wrap); + } + int done; /* Lock stream. */ |