public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/fw/vfprintf-2] stdio-common: Add lock optimization to vfprintf and vfwprintf
Date: Mon, 12 Dec 2022 15:21:18 +0000 (GMT) [thread overview]
Message-ID: <20221212152118.1D505385B512@sourceware.org> (raw)
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. */
reply other threads:[~2022-12-12 15:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221212152118.1D505385B512@sourceware.org \
--to=fw@sourceware.org \
--cc=glibc-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).