public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/fw/vfprintf-2] stdio-common: Add lock optimization to vfprintf and vfwprintf
@ 2022-12-12 15:21 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2022-12-12 15:21 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a407f0532feffbc31a3fa89754dc2313bd56eb89
commit a407f0532feffbc31a3fa89754dc2313bd56eb89
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Aug 18 08:49:54 2022 +0200
stdio-common: Add lock optimization to vfprintf and vfwprintf
After the rewrite and the implicit unbuffered streams handling, this
is very straightforward to add.
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-12 15:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 15:21 [glibc/fw/vfprintf-2] 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).