This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] argp: Use fwrite_unlocked instead of __fxprintf when !_LIBC
- From: Florian Weimer <fweimer at redhat dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: Khem Raj <raj dot khem at gmail dot com>, libc-alpha at sourceware dot org
- Date: Mon, 4 Jan 2016 20:38:06 +0100
- Subject: Re: [PATCH] argp: Use fwrite_unlocked instead of __fxprintf when !_LIBC
- Authentication-results: sourceware.org; auth=none
- References: <1451679626-28351-1-git-send-email-raj dot khem at gmail dot com> <568A1AEE dot 4050402 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1601041535580 dot 24114 at digraph dot polyomino dot org dot uk>
On 01/04/2016 04:36 PM, Joseph Myers wrote:
> On Mon, 4 Jan 2016, Florian Weimer wrote:
>
>> On 01/01/2016 09:20 PM, Khem Raj wrote:
>>
>>> +#ifdef _LIBC
>>> __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
>>> +#else
>>> + fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
>>> +#endif
>>
>> Why not use fwrite_unlocked unconditionally?
>
> Does fwrite_unlocked work on wide-oriented streams in glibc (the point of
> __fxprintf as I understand it being to work whatever the orientation of
> the stream)?
Oh, I didn't know this was the point of fxprintf. No, in this case,
using fwrite_unlocked would not work (in fact, it would be undefined).
Florian