public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] stdio-common: Add lock optimization to vfprintf and vfwprintf
@ 2022-12-19 18:56 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2022-12-19 18:56 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3d0005b54af06d3bb7ab9f85bfe6a27552b11f74
commit 3d0005b54af06d3bb7ab9f85bfe6a27552b11f74
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Dec 19 18:56:54 2022 +0100
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>
Diff:
---
stdio-common/vfprintf-internal.c | 8 ++++++++
1 file changed, 8 insertions(+)
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. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-19 18:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 18:56 [glibc] stdio-common: Add lock optimization to vfprintf and vfwprintf Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).