diff options
author | Florian Weimer <fweimer@redhat.com> | 2022-12-19 18:56:54 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2022-12-19 18:56:54 +0100 |
commit | 3d0005b54af06d3bb7ab9f85bfe6a27552b11f74 (patch) | |
tree | 109090dd8f31b4f373605342275e436279191d4c /stdio-common | |
parent | e88b9f0e5cc50cab57a299dc7efe1a4eb385161d (diff) | |
download | glibc-3d0005b54af06d3bb7ab9f85bfe6a27552b11f74.tar.gz glibc-3d0005b54af06d3bb7ab9f85bfe6a27552b11f74.tar.xz glibc-3d0005b54af06d3bb7ab9f85bfe6a27552b11f74.zip |
stdio-common: Add lock optimization to vfprintf and vfwprintf
After the rewrite and the implicit unbuffered streams handling, this is very straightforward to add. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'stdio-common')
-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 83a6aea510..23ada8d0ff 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. */ |