* [PATCH] mntent: Use __putc_unlocked instead of fputc_unlocked
@ 2021-01-08 14:27 Siddhesh Poyarekar
2021-01-08 14:42 ` H.J. Lu
0 siblings, 1 reply; 2+ messages in thread
From: Siddhesh Poyarekar @ 2021-01-08 14:27 UTC (permalink / raw)
To: libc-alpha; +Cc: stli
__putc_unlocked is guaranteed to be inlined all the time as opposed to
fputc_unlocked, which does not get inlined when glibc is built with
-Os.
---
misc/mntent_r.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 30383a4a26..1005e143ab 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -223,16 +223,16 @@ write_string (FILE *stream, const char *str)
while ((c = *str++) != '\0')
{
if (strchr (encode_chars, c) == NULL)
- fputc_unlocked (c, stream);
+ __putc_unlocked (c, stream);
else
{
- fputc_unlocked ('\\', stream);
- fputc_unlocked (((c & 0xc0) >> 6) + '0', stream);
- fputc_unlocked (((c & 0x38) >> 3) + '0', stream);
- fputc_unlocked (((c & 0x07) >> 0) + '0', stream);
+ __putc_unlocked ('\\', stream);
+ __putc_unlocked (((c & 0xc0) >> 6) + '0', stream);
+ __putc_unlocked (((c & 0x38) >> 3) + '0', stream);
+ __putc_unlocked (((c & 0x07) >> 0) + '0', stream);
}
}
- fputc_unlocked (' ', stream);
+ __putc_unlocked (' ', stream);
}
/* Write the mount table entry described by MNT to STREAM.
--
2.29.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mntent: Use __putc_unlocked instead of fputc_unlocked
2021-01-08 14:27 [PATCH] mntent: Use __putc_unlocked instead of fputc_unlocked Siddhesh Poyarekar
@ 2021-01-08 14:42 ` H.J. Lu
0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2021-01-08 14:42 UTC (permalink / raw)
To: Siddhesh Poyarekar; +Cc: GNU C Library, Stefan Liebler
On Fri, Jan 8, 2021 at 6:28 AM Siddhesh Poyarekar via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> __putc_unlocked is guaranteed to be inlined all the time as opposed to
> fputc_unlocked, which does not get inlined when glibc is built with
> -Os.
> ---
> misc/mntent_r.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/misc/mntent_r.c b/misc/mntent_r.c
> index 30383a4a26..1005e143ab 100644
> --- a/misc/mntent_r.c
> +++ b/misc/mntent_r.c
> @@ -223,16 +223,16 @@ write_string (FILE *stream, const char *str)
> while ((c = *str++) != '\0')
> {
> if (strchr (encode_chars, c) == NULL)
> - fputc_unlocked (c, stream);
> + __putc_unlocked (c, stream);
> else
> {
> - fputc_unlocked ('\\', stream);
> - fputc_unlocked (((c & 0xc0) >> 6) + '0', stream);
> - fputc_unlocked (((c & 0x38) >> 3) + '0', stream);
> - fputc_unlocked (((c & 0x07) >> 0) + '0', stream);
> + __putc_unlocked ('\\', stream);
> + __putc_unlocked (((c & 0xc0) >> 6) + '0', stream);
> + __putc_unlocked (((c & 0x38) >> 3) + '0', stream);
> + __putc_unlocked (((c & 0x07) >> 0) + '0', stream);
> }
> }
> - fputc_unlocked (' ', stream);
> + __putc_unlocked (' ', stream);
> }
>
> /* Write the mount table entry described by MNT to STREAM.
> --
> 2.29.2
>
LGTM.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-08 14:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 14:27 [PATCH] mntent: Use __putc_unlocked instead of fputc_unlocked Siddhesh Poyarekar
2021-01-08 14:42 ` H.J. Lu
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).